Preserving previous location while authenticating #125
-
I'm trying to preserve the previous location so I can send the user there after they authenticate.
What is the best practice using |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
You can capture the location from |
Beta Was this translation helpful? Give feedback.
-
Thanks for the info. Just my two cents regarding the doc (which is already close to perfection (Y)). The |
Beta Was this translation helpful? Give feedback.
-
I have a similar issue which is after submitting the form or clicking the cancel button, how can I jump back to the previous page, or a few pages back. |
Beta Was this translation helpful? Give feedback.
-
I tried to use useNavigate to implement it but it seems I have to provide a specific |
Beta Was this translation helpful? Give feedback.
You can capture the location from
useLocation
oruseRouter
into something persistent like localStorage or even a?redirect=url
search param, then either declaratively<Navigate>
or imperativelyuseNavigate
to a new route. When things are good, do the same back to the original location you captured.