Answer the question
In order to leave comments, you need to log in
How to change the global redux store depending on the React App route?
Good afternoon. There is a large application consisting of two independent parts. One is loaded by default, the second is loaded when the "/bla-bla" route is appended. How can you make it so that when you go through this route, your redux store is loaded, which does not know anything about the existence of the default one?
Thank you.
Answer the question
In order to leave comments, you need to log in
In a good way, divide the application into two parts and define your own store in each.
But nothing prevents you from using an unlimited number of stores in one application:
Example 1:
const store1 = configureStore1();
const store2 = configureStore2();
const App = () => (
<>
<Provider store={store1}>
<MainProject />
</Provider>
<Provider store={store2}>
<SubProject />
</Provider>
</>
);
const store1 = configureStore1();
const store2 = configureStore2();
const App = () => (
<Provider store={store1}>
<>
<MainProject />
<Provider store={store2}>
<SubProject />
</Provider>
</>
</Provider>
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question