373 followers
I am a Freelance React developer. I work with startups to build MVPs. I learn new things and try out some code that I like to share in my blogs. I also blog at vijayt.com
From a React web application, it is possible to access the camera. The browser support for that is very good. Our objective is to show the camera output in a video element. Create a video element and attach a ref to it. <video ref={videoRef} autoPlay...
Inversion of control is a design pattern. I will explain this with an example. Let's write a class Car with a drive method: class Car { drive(): void { console.log('I am driving a car'); } } We will add one more class Bus with a drive method...
The useState hook is probably the most popular and frequently used hook in React. There were a few questions I had about it. If a component had multiple useState hooks and an event handler did multiple state updates, will the component render multipl...
JavaScript has many nuances. Constructor and Prototype are difficult to understand concepts in JavaScript. So, instead of explaining everything about constructor and prototype, I will explain only the relevant parts that cause confusion. Consider the...
JavaScript has types. But, those types are not strictly enforced. We have to use type guards in our code. There are three types of type guards. To check if the type of a variable is a number, we use: let sum = 0; if (typeof count === 'number') { su...
The more I read React documentation at the official website, the more I get confused. That is probably because I don't understand some of the terminology there. The most recent confusion was me trying to understand the difference between useEffect an...