I want to be able to pass some contexts only for some pages, but the way react-router is made I can't find out how to do that. For example, I want to AlertsProvider to be available only to alerts screen, GroupsProvider to be available only for groups screen and so on
How can I do this?
Here is the code I have right now:
<React.StrictMode>
<GlobalStyle />
<BrowserRouter>
<AuthProvider>
<PropertiesProvider>
<BuyersProvider>
<AlertsProvider>
<GroupsProvider>
<Switch>
<PrivateRoute path="/" exact component={Dashboard} />
<Route path="/login" exact component={Login} />
<Route path="/recover_password" exact component={RecoverPassword} />
<PrivateRoute path="/imoveis" exact component={Properties} />
<PrivateRoute path="/compradores" exact component={Buyers} />
<PrivateRoute path="/grupos" exact component={Groups} />
<PrivateRoute path="/alertas" exact component={Alerts} />
<PrivateRoute path="/relatorios" exact component={Reports} />
</Switch>
</GroupsProvider>
</AlertsProvider>
</BuyersProvider>
</PropertiesProvider>
</AuthProvider>
</BrowserRouter>
</React.StrictMode>