0

I have been trying to pass a state to the other page via route while using the useNavigate hook in the react-location. I looked all over the internet for it and couldn't find a solution. All the answers I found were for react-router, but I need it with the react-location. Does anybody have any idea about it?

import { useNavigate } from 'react-location';

// And inside the component
const navigate = useNavigate();

// To navigate
navigate({to: path})
Sanjay Joshi
  • 2,036
  • 6
  • 33
  • 48

1 Answers1

0

Looks like I need to share state/data using the search key. This is how I did it.

navigate({to: path, search: state})

Just dropping my answer here so it could help others if they face the same issue. Thanks

Sanjay Joshi
  • 2,036
  • 6
  • 33
  • 48