WHAT IS STORYBOOK ?

Storybook is a development environment and playground for UI components. It allows you to create components in isolation, mock hard-to-reach use cases, and document components for your team.

NEED OF STORYBOOK AND DOCS :

Suppose you are given a task to add a feature (Component) :

These are the steps you need to go through :

Creating component from both ends(Front & back) → running app → authentication → finally reviewing that new feature

What you actually needed : reviewing that new feature

Screenshot 2024-10-01 222411.png

Consequences of it :

PROS

Providing Tool to create and focus explicitly on the feature you wanted to build at the first place and also extract individual features of it.

CONS

Screenshot 2024-10-01 225416.png

SETTING UP STORYBOOK

To set up Storybook in your React project:

Storybookdemo/src/Stories folder(containing some demo stories)

Storybookdemo/src/Stories folder(containing some demo stories)

You can delete these demo stories and create you own inside your components folder.

(If not getting steps ,please have a look at official docs : https://storybook.js.org/docs)

Storybook Interface (For demo stories)

Once you execute this command npm run storybook in terminal, you will be redirected to a interface where you can view the stories of your component and play with it’s configurations.