Skip to content

Instantly share code, notes, and snippets.

@jubayer-webdev
Created August 3, 2024 09:12
Show Gist options
  • Select an option

  • Save jubayer-webdev/248bfdc0bbbc32dbe8147326dd074cdd to your computer and use it in GitHub Desktop.

Select an option

Save jubayer-webdev/248bfdc0bbbc32dbe8147326dd074cdd to your computer and use it in GitHub Desktop.
const location = useLocation(); <Navigate to="/login" state={{ fromJame: location }} replace />; the key for state object can be any name.
{
"hash": "",
"key": "default"
"pathname": "/hss",
"search": "",
"state": null,
}
{
"hash": "",
"key": "tynn5346"
"pathname": "/login",
"search": "",
"state": {
"fromJame": {
"hash": "",
"key": "default"
"pathname": "/hss",
"search": "",
"state": null,
}
},
}
@jubayer-webdev
Copy link
Author

Important

state key can be any name.

state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment