Why isn't beforeLoad used instead of useLayoutEffect in the React Example: Kitchen Sink React Query File Based?
#5173
-
|
I am working in an app where I was getting some crazy redirects from my login page and one thing I noticed was that one of the spots it was stemming from was based on the example from the docs, 'React Example: Kitchen Sink React Query File Based' specifically, the login.tsx file. A redirect is performed in In my own implementation, I removed the Any thoughts would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
From what I've gathered from continued exploration, the answer to my question is basically that Something else I learned along the way is the the reason for I still don't know why I'm getting crazy redirects lol, but at least I know a little more about what I'm looking at |
Beta Was this translation helpful? Give feedback.
From what I've gathered from continued exploration, the answer to my question is basically that
beforeLoadshould be used for auth when we never want the user to hit the page at all whileuseLayoutEffectcan be used when we want the user to hit the page, but redirect ASAP.Something else I learned along the way is the the reason for
useLayoutEffectvsuseEffectis what I mentioned, redirecting ASAP vs letting the browser load everything and then do whatever is in theuseEffect.I still don't know why I'm getting crazy redirects lol, but at least I know a little more about what I'm looking at