How to write story that updates component?
See original GitHub issueI would like to simply see if component behaves correctly when it receives new props. Or even if it receives same props so it’s possible to check that there is no logical error with shouldComponentUpdate
. Is there some way for that?
Perhaps an idea for addon? Although I see tiny problem with addons that they cannot be combined, so if such functionality comes with addon, I could not use info addon for that story.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to write stories - Storybook - JS.ORG
We define stories according to the Component Story Format (CSF), an ES6 module-based standard that is easy to write and portable between tools....
Read more >How to write story that updates component? #315 - GitHub
Component will get updated when location is retrieved. I can write story for a first case, but I am failing with other one....
Read more >How to write an 'Update me' article - Smartocto
Be sure to state the facts, answering the who, what, why, where and when questions.
Read more >What is Storybook and How Can I Use It to Create a ...
Once you build out a component, Storybook lets you create a "story" file where you can then import your component and create various...
Read more >Storybook understanding and ways writing of Stories for React
The component we create is called the story in Storybook. In this article, we will understand the following topics: How to write a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
componentWillUpdate
is not called in the initial render. We always do the initial rendering for all stories. That to prevent to state related issues.So, if you wanna test
componentWillUpdate
you need to run render your component inside a wrapper component.That wrapper component may have a some kind of a button which re-render your original component. Then it’ll call the
componentWillUpdate
.Ah, sorry, I wanted to try it first before responding, but never got a chance with it (more priority stuff). But what you said makes total sense.