Replies: 1 comment
-
If you move that code to the I recommend you to keep that code where you have it, in the more specific route you can. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using react router v7 in SPA mode (
ssr: false
).Highlevel details of my project
/home/s1/s2
.Question
Currently, I am fetching these states in the home clientLoader and redirecting to
/home/s1/s2
again. This works for my use case but doesn't seem like a good practice to me.Here is my current home clientLoader code:
I was wondering if this needs to be done on the root clientLoader. If so, can someone please suggest or guide me on what is the proper setup for project requirement ?
Also, lets say user is visiting
/somepath
and root clientLoader runs. Will root clientLoader run again in the below cases ?/diffpath
from the current route/somepath/p1
from the current routeI am asking this because I don't want to recompute s1 and s2 again and again.
Apologies if my question is very basic. I am new to react router v7 and trying to understand the ideal usage (there doesn't seem to be lot of resources).
Beta Was this translation helpful? Give feedback.
All reactions