Unable to pass State in React Router link

Viewed 819

My target is really simple, i want to pass a param from one page to another by using Link state:

Sender Page:

import {Link} from "react-router-dom";
...
<Link className="start" to={{pathname: "/game", state: {string: "something to pass"}}}>
       clickme
</Link>
...

Reciever Page:

import {Link, useLocation} from "react-router-dom";
.....
let location = useLocation();
....

But console.log(location) keeps showing me an empty state: enter image description here

1 Answers
Related