passive-yellow
passive-yellow9mo ago

useNavigation

http://localhost:5173/inquiry/create/inquiry-type-create
http://localhost:5173/inquiry/create/inquiry-type-create
const { replace} = useNavigation();
const { replace} = useNavigation();
replace("inquiry/create") is not work
2 Replies
kapa.ai
kapa.ai9mo ago
Hi @hoaanhtuc. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The replace method from the useNavigation hook in refine is used to replace the current history state instead of adding a new URL into the stack. If replace("inquiry/create") is not working as expected, it might be due to how the replace method is defined or accessed. Here's an example of how you can use the replace method from useNavigation:
import { useNavigation } from "@pankod/refine";

const MyComponent = () => {
const { replace } = useNavigation();

return (
<button onClick={() => replace('inquiry/create')}>
Go to Inquiry Create Page
</button>
);
};
import { useNavigation } from "@pankod/refine";

const MyComponent = () => {
const { replace } = useNavigation();

return (
<button onClick={() => replace('inquiry/create')}>
Go to Inquiry Create Page
</button>
);
};
In this example, clicking the button will trigger the replace method and replace the current history state with the inquiry/create path. If it's still not working, I would recommend checking the official refine documentation for more information on how to use the useNavigation hook and its replace method: - useNavigation hook documentation (link (https://refine.dev/docs/api-reference/core/hooks/navigation/useNavigation/)) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai9mo ago
<@617879699363725341> kapa.ai is still learning and improving, please let us know how it did by reacting below