Nested stories with DI
The preceding example is good enough. It creates a storybook, it is reusable, and everyone is happy. However, as the application grows and we add more stories, it is not always possible to fix this with a Provider, or the Provider may have been used in too many stories.
In this section, we will refactor our code to be able to inject our own component instead of importing the NavButton container. As our goal is to retain the functionality that we had previously, in the storybook we will inject a NavButton story, which will take care of the navigation problem. However, in the normal app, we will inject the NavButton container just as before but into the TaskList container. The win here is the fact that we will not need ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access