Ion Router - state lost

Hi :slight_smile:

i´m using createContext, useReducer and build a state managment.
Now i use IonReactRouter IonRouterOutlet and Route.

When i click on a Rout the state is getting lost.

i guess a beginner question :expressionless:

thanks for help

Welcome to the forums!

Without seeing your code, it’s hard to say what the problem is. But depending on what you are doing, you can wrap the context around the router-- if the context is the parent of the router in the tree, then it shouldn’t be possible for the router to mess up the context, because the router exists “below” the context.

For example, I wrap my router with all my contexts like this:

  return (
            <QueryClientProvider client={queryClient}>
              {/* <ReactQueryDevtools /> */}
                  <MyRouterComponent />

thx @ptmkenny (y)

i now use <Link …
so the screen isn´t left and the state is keep

thx for feedback