From the course: Building UI Components with Storybook: Master React Components and UI Design with Storybook for Better Efficiency

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Creating stories with mock state and events in Storybook

Creating stories with mock state and events in Storybook

We have our counter example over here and we see that we're incrementing well now and we have our storybook running as well Okay, so we should be on the same page. Let's create our counter story. So in our components, we're gonna make a new file We're gonna call it counter dot stories dot JSX same drills before and I hope you're as excited as I am because we are getting close now to the crux of really encapsulating all the Essentials for building a storybook, so we want to import react And we're going to create our mock version of state, so we're going to bring in state into the storybook as well all right, and So we bring in that we can bring in our button counter right because part of our counter Component contains our button counter, so we'll bring that in as well We're going to bring in the counter of course for the component itself very important And let's start with these, okay, and we can continue after that. So how do we actually create a default story? If I were to save and…

Contents