Skip to content

Stories for errorElements #69

Answered by JesusTheHun
bostrom asked this question in Q&A
Discussion options

You must be logged in to vote

So if I understand your issue correctly, your problem is that the decorators of your story are not rendered, because the real story is actually the error component, right ?

The first thing that comes to mind is to split the component : one that calls useRouteError() and one that accept the result of that call as a prop. This way you can make your story using the stateless component.

Also, the order of the decorators matters. It defines who wraps who. So if the router decorator comes first, even your error component will be wrapped, as you can see in this stackblitz : https://stackblitz.com/edit/storybook-addon-remix-react-router-d6htzf?file=src%2Fstories%2Fbasics.stories.tsx

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bostrom
Comment options

Answer selected by bostrom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants