Skip to content

Two different export createBrowserRouter when Page is lazy route using recoil to update store will show fail message #10829

Closed Answered by brophdawg11
johnkao3 asked this question in Q&A
Discussion options

You must be logged in to vote

You shouldn't be creating your data router inside of the react render lifecycle, otherwise it will be destroyed and recreated on each render. Instead, it should be created as a singleton outside of React and passed to RouterProvider. There's an example of this setup in the docs.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by johnkao3
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