Avoid Provider nesting
I am going to have a lot of Providers in my App, and i did not want to have 5+ nesting around my rotes.
Here is the example with just 2 providers:
So i though i could put all my providers into to a single component, and then only have 1 "Provider" around my Routes. However when i do this, i can see from logging that my providers are created, but non of the sub-components have assess to the useUser or useProtfolios as they are undefined. This works fine when i have the providers around my rote but not when i wrap them in a component. Should the following not work?
App.tsx i replace the 2 providers with <AppProviders>...</AppProviders>
2 Replies