I am trying to 'go back' one web page using useNavigate but I also need to pass data to that page also.
When I use:
const navigate = useNavigate();
navigate(-1, {state: {data: myData});
I am able to navigate to the previous page, but I do not receive the data. This page I am trying to go back to is actually the home page so if i try:
navigate('/', {state: {data: myData});
I am able to navigate to the home page and receive the data. I would like to use
navigate(-1, {state: {data: myData});
as it would be more convenient to scale my website moving forward. Help please.