Router.push not working when used with library hook.
Unanswered
andrefmoleirinho posted this in #help-forum
Router.push from next/navigation doesn't work when I have a client component that utilizes my home-made library hook useToast.
I have a provider at the top of the app and router.push only works if the component using this useToast is dynamically imported.
For e.g
Well, I don't want to be using dynamic everytime I need to useToast on a component.. what could be the cause/how to fix this in my library made with React/Vite or within my nextjs app using this toast?
By the way, this didn't happen in router.push from next/router.. only here in App router
const { toast } = useToast();I have a provider at the top of the app and router.push only works if the component using this useToast is dynamically imported.
For e.g
const SomeComponent = dynamic(() => import("@someurl/SomeComponent"));`Well, I don't want to be using dynamic everytime I need to useToast on a component.. what could be the cause/how to fix this in my library made with React/Vite or within my nextjs app using this toast?
By the way, this didn't happen in router.push from next/router.. only here in App router
1 Reply
Any update? @Siberian