Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For react 18, <RouteProvider> needs to be above react's <StrictMode> #102

Closed
awdyson opened this issue Mar 30, 2022 · 2 comments · Fixed by #103
Closed

For react 18, <RouteProvider> needs to be above react's <StrictMode> #102

awdyson opened this issue Mar 30, 2022 · 2 comments · Fixed by #103

Comments

@awdyson
Copy link

awdyson commented Mar 30, 2022

If it isn't, URL updates (including route().link) won't trigger view updates.
Not sure if this is a documentation change issue or a revamp.

Here's some working code though:

const root = createRoot(document.getElementById('app') as HTMLElement);

function App() {
  return (
    <RouteProvider>
      <StrictMode>
        // other providers and content
      </StrictMode>
    </RouteProvider>
  );
}

root.render(<App />);

If I were you, I'd leave this open for a while, even if you update the docs.
Issues are generally the first place I look if something is funky 😛

Also, this seems ominous... facebook/react#21674 (comment)

@bradenhs
Copy link
Contributor

Thanks for bringing this up! I did some testing on experimental builds of react a while back but haven't tried out the 18 release yet with Type Route. I'll do that soon.

@bradenhs
Copy link
Contributor

bradenhs commented Apr 1, 2022

This should be fixed in https://github.com/typehero/type-route/releases/tag/0.7.0. Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants