Accepted answer

You can pass it by mentioning the props in state

    pathname: "/InvoiceDetails",
    state: { name: 'jack', age: 25, city: 'Antwerp'}

Read about it more here

And to use it in your next component you have to either wrap your component with a react-router-dom HOC withRouter or use useLocation hook they have provided.

EX- In your second component -

import {useLocation} from "react-router-dom";

function Child() {
 let data = useLocation();
 console.log(data); //state would be in data.state//

Related Query

More Query from same tag