Routing with async data
Consider the following setup where my context has
Note that useUser is a react query. On direct navigation to this page I want to check this users permissions list, and redirect them if they don't have it
How can I achieve this, as user is initially null until the data loads from the query - redirecting them every time? Would I have to add some kind of loading into the context and catch that at a higher level perhaps for all pages this might affect?
user: User | null:Note that useUser is a react query. On direct navigation to this page I want to check this users permissions list, and redirect them if they don't have it
How can I achieve this, as user is initially null until the data loads from the query - redirecting them every time? Would I have to add some kind of loading into the context and catch that at a higher level perhaps for all pages this might affect?