How to do mutation on page load? #10798
Unanswered
unclekingpin
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I would do it on the loader, if the route is going to redirect then the loader is unlikely to be revalidated. The app will load, RR will match your route, it will run the loader, it will do the mutation and redirect, if the token is not on the URL it can redirect to a separate error page. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I have a usecase in my app which seems to be not that easy to solve with React and ReactRouter (or at least not to me) and i was hoping you can help me.
I have a route in my react app that must read a token from the url and execute a mutation once (POST request), based on the result it must redirect to a different page in the app. The token is meant to be used once. If the request is executed again with the same args it will fail.
What other options are there?
Beta Was this translation helpful? Give feedback.
All reactions