Unit testing in Reactjs with Jest, act()
By default when we create reactjs application it comes bundled with Jest to help test react components. To quickly setup just create a folder __tests__
in src/
. Then we can create tests file with naming conventions like App.test.js
i.e. <component-name>.test.js
.
Using docker for local development environment
Yes you can use Docker for setting up your local development environment. The ability of docker to create containerized environments can be really helpful when you are working on applications that have conflicting versions of libraries.
Setting up eslint for JS in VS Code
Recently i was trying to setup eslinting for one of my projects based on JS. I have switched from atom to using VS Code for all my projects as its more stable and have recently gained so much popularity due to so many available plugins and the backing of Microsoft. So as I was working on setting up a JS project i am trying to make sure that my code follows strict guidelines for ES6 and the code is more consistent. VS Code has a very nice plugin for eslint which is called ESLint.
Transforming a callback to Promise
I promise
it will be quick ;). If you are new to Javascript or even if you have been working for while, we all have experienced callback functions when we are trying to run some tasks before we finish the predecessors. It gets tougher when the functions are not synchronous and are actually async in nature like getting a response from server which is not guaranteed to be responding right away which leads to errors in our applications. In order to solve such issues callback functions started getting used.
How to dockerize a ReactJS app
I recently was developing a small demo single page application in ReactJS and was decided to use docker to run. With my setup i was able to run my react app served through nginx. Lets get into how to define the configuration for Docker.