useRouter & Storybook
andryxxa93 opened this issue · 3 comments
andryxxa93 commented
andryxxa93 commented
In order not to create another issue, I’ll mention here that the back method from the useRouter and usePageService hooks does not return back.
SuperOleg39 commented
Hello!
At first, stop to destructurize Router object, as I mention in previous issue)
And Router in storybook addon is just a simple mock:
- https://github.com/tramvaijs/tramvai/blob/main/packages/tramvai/storybook-addon/src/decorators/routerDecorator.tsx
- https://github.com/tramvaijs/tramvai/blob/main/packages/tramvai/test/mocks/src/router.ts#L18
useRouter
can return nothing if you have a few @tinkoff/router
copies, and Router Context object will be different in decorator and component.
You need to follow this guide - https://tramvai.dev/docs/guides/storybook
andryxxa93 commented
Thanks, it's helped!