Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interaction between React and Storybook

We already know that Storybook is for building UI components and keeping them isolated from the business logic. I have implemented some basic examples of StoryBook.

Now I am very curious to know about the Storybook internal behavior means how it interacts with the react main application, the workflow of the Storybook after executing the npm run storybook command starting from the entry point to exit?

I'd also like to know why we don't use npm start for running the storybook?

Thanks :)

like image 632
Subrato Pattanaik Avatar asked Oct 18 '25 14:10

Subrato Pattanaik


1 Answers

Storybook doesn't interact with your react application.
It is just a library for components in your project.

It gives you a variety set of tools to create examples of components usage.
This is why you need to write stories separately from actual react application. And all these stories have no any intersection with your app.

Command npm run storybook just build all the stories that you've written and build useful ui for that so you can browse them easily. That becomes extremely useful when you have a big code base.
Because it is difficult to know every component you have in project and how it works. And Storybook provides us with an instrument to have all components more structured.

You can also use npm start for that. It is just about how you configure scripts in package.json.

like image 76
Anton Bakinowsky Avatar answered Oct 20 '25 04:10

Anton Bakinowsky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!