history.push

can i use history.push("/customroute',{data:"something"}) in refine and i want to access that in using useLocation hook in that route
5 Replies
automatic-azure
automatic-azure2y ago
please share documentation of useParam?
absent-sapphire
absent-sapphire2y ago
Hi @rehan1 , sorry for late response. i will create example for you
automatic-azure
automatic-azure2y ago
okay thanks
absent-sapphire
absent-sapphire2y ago
you can use useNavigate from @pankod/refine-react-router-v6 https://reactrouter.com/en/6.5.0/hooks/use-navigate navigate takes state object as a second argument. you can read from other page with useLocation() 's returning state object
import { useNavigate,useLocation } from "@pankod/refine-react-router-v6";

const navigate = useNavigate();
const { state } = useLocation();



navigate("/posts", { state: { stateTest: "navigation-state-test" },});
import { useNavigate,useLocation } from "@pankod/refine-react-router-v6";

const navigate = useNavigate();
const { state } = useLocation();



navigate("/posts", { state: { stateTest: "navigation-state-test" },});
automatic-azure
automatic-azure2y ago
thanks