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
From the course: Building UI Components with Storybook: Master React Components and UI Design with Storybook for Better Efficiency
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Installing and setting up Storybook into your project application from scratch14m 45s
-
(Locked)
Overview of how Storybook is configured with web app projects9m 29s
-
(Locked)
How to build a component in React with Storybook: Visual breakdown10m 44s
-
(Locked)
Build a basic sub-component in React4m 40s
-
(Locked)
How to build a story for React components from scratch6m 36s
-
(Locked)
How to use args in Storybook for multiple dynamic component stories6m 2s
-
(Locked)
How to use argTypes and controls in Storybook to create user-friendly stories5m 28s
-
(Locked)
Automating documentation for web components with Storybook6m 50s
-
(Locked)
Customizing docs and values with Storybook11m 26s
-
(Locked)
Adding component complexity for Storybook arguments9m 8s
-
(Locked)
CSS techniques and Storybook rendering9m 48s
-
(Locked)
What are actions in Storybook and the synthetic base event object?10m 3s
-
(Locked)
Hooking up live React components to Storybook and rendering fundamentals15m 24s
-
(Locked)
Creating stories with mock state and events in Storybook7m 36s
-
(Locked)
Testing interactions and events with React components in Storybook13m 56s
-
(Locked)
-
-
-
-