React, testing

Jest Snapshot Testing for React Components is useless? Is it slowly dying? 🧐🤔😐

All the React developers will agree, mostly everyone has used Jest at least once in their dev life.
Yes, It’s true for me too. 👋

ReactJS team also suggested people use Jest to test their app. Which is fair as Jest was also created by Facebook. 👏

Jest is cool. But later they came up with something called Jest Snapshot testing. And as usual, they also suggested developers use it to test their React components.👏👏

First, let’s see what’s Snapshot testing with Jest-

Continue reading
Standard
React

Storybook : develop React components in isolation | Part-2

On the Part-1 of this series Storybook : develop React components in isolation | Part-1 , we talked about how we can setup Storybook and start working for our awesome UI-components Library.

Today we will see how we can create our first UI component and add it to Storybook. We will also see how we can see variations for the same component.

I will remove the welcome file src/stories/0-Welcome.stories.js which was created by the tool. Now our app structure looks like below-

Let’s create a new component inside src/components/Spinner.js file.

Continue reading
Standard
React

Storybook : develop React components in isolation | Part-1

Storybook is a tool for developing UI components.

The tool enables developers to create components independently and showcase components interactively in an isolated development environment.

Storybook runs outside of the main app so we can develop UI components in isolation without worrying about app specific dependencies and requirements.

After running, Storybook looks like this ☝️
Here, Button is a component.

Continue reading
Standard
JavaScript, React

Style React component with styled-components : Part-2

In My Previous post Style React component with styled-components : Part-1 , I wrote how we can start using styled-components and we created one Spinner component with it.

Now we can see, how we can pass props to the styled component named StyledSpinner and change the color/behavior of it.

For this example, I will change the border color by passing prop. So, the styled component will show the color what we pass to it. Continue reading

Standard