Alternative for history.listen(newLocation, action) in react-router-dom v6 #8500
Unanswered
vinibretzke
asked this question in
Q&A
Replies: 1 comment
-
If you're just trying to prevent the user from going back to the login page, you can update the login form to use <Form method="post" replace> |
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.
-
Hi All,
On my company we have a react application that is using really outdated libraries and react-router-dom is one of them (is running the v4 version of it). So the work to update all the libraries was assigned to me.
I need some help regarding the history.listen function that was removed on RRD v6. I know I can track locations by using useLocation(), turns out that I need to also track the action that the user is performing, for example the "POP" action (going backward on the page).
Currently (using v4) we are doing like this on componentDidMount:
Turns out that I don't know how to handle that using react-router-dom v6, there is no place in docs that says something about the "POP" action.
Anyone has an idea how to handle that?
Thanks for the help
Beta Was this translation helpful? Give feedback.
All reactions