withRouter is preventing useArgs to be called in stories in Storybook V7
Closed this issue · 3 comments
withRouter
is not letting useArgs()
work in Storybook 7.
Here are two discussions for issues within storybook 7 that looks related:
storybookjs/storybook#12006 (comment)
storybookjs/testing-react#30 (comment)
It seems the reason can be the way story()
is being called and it's not being called like a React node so it loses its args state.
https://github.com/JesusTheHun/storybook-addon-react-router-v6/blob/0b95fa7465ce4269051645dbfa0138c99f98f2d4/src/withRouter.tsx#LL44C9-L44C44
AFAICT the SB team says you should not use this hook inside a React component. It's unclear why should support this, or how
I couldn't find anything regarding using useArgs()
inside a Story as a bad practice. But even if you don't use it inside a story and just use it in an AddOn still the AddOn will have the same issue.
What do you expect me to do ?