question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested Router error after upgrading to Storybook v6.4 from v6.3

See original GitHub issue

Thank you for this great platform. We’re using react-router v6 in our project and some of our storybook components are using the useLoaction() hook of react-router. So we provide a location for the components by a decorator like this. After we upgrade Storybook from v6.3 to v6.4 we encounter the following error. So now we have to lock the minor version as ~6.3.8. Do you have any suggestions for that? Thank you.

截圖 2022-03-14 下午3 38 48

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
shilmancommented, Mar 15, 2022

We’ve updated the way we handle react-router in 6.5. Try upgrading to the latest prerelease:

npx sb@next upgrade --prerelease

Does that fix it?

1reaction
karsai5commented, Mar 29, 2022

After doing some more reading I found this comment which seems to work in case anyone else runs into the same issue https://github.com/remix-run/react-router/issues/7375#issuecomment-975431736.

My decorator now looks like this:

(Story) => (
  <UNSAFE_LocationContext.Provider value={null}>
    <MemoryRouter>
      <Story />
    </MemoryRouter>
  </UNSAFE_LocationContext.Provider>
),
Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested routing is not working in React Router v6
The default behavior of React Router fails to render multiple child routes with single Outlet. For example - When there is requirement to ......
Read more >
Upgrading Storybook
Upgrade script. The most common upgrade is Storybook itself. Storybook releases follow Semantic Versioning. We publish patch releases with bug fixes ...
Read more >
Ultimate React Router v6 Guide
React Router is by far the most popular routing library in React and this article goes in depth on everything you need to...
Read more >
React Router 6: Nested Routes - Robin Wieruch
A step by step example on Nested Routes with React Router ... ... The code for this React Router v6 tutorial can be...
Read more >
Amazing New Features In React & React Router v6 - Medium
The above is standard code that is used to created routes for navigation in React projects. Now let's check React router v6 code:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found