| by Gagandeep Singh | No comments

undefined and null in Javascript

undefined In Javascript undefined (a primitive type in Javascript) gets assigned to a variable that we declare but don’t assign a value to. It’s Javascript’s way of telling that the value of this variable is not defined. Even a function in Javascript which does not return anything, will return undefined by default. So, to avoid […]

Read More
| by Gagandeep Singh | No comments

Docker – useful commands

To run a container using an image docker run <image name> example: docker run hello-world Override the default command for a container docker run <image name> command example: docker run busybox ls Show running containers docker ps docker ps –all This will list all the containers that were ever created on your machine. Restart stopped […]

Read More
| by Gagandeep Singh | No comments

Using useState hook with the previous state

Let’s take a very basic use case of the useState() hook; updating the count variable on each click. The code look perfectly fine and will work as expected in almost every time. BUT the issue with this code is that setCount() doesn’t guarantee that the previous count that it’s going to use to either increment […]

Read More