This content originally appeared on flaviocopes.com and was authored by flaviocopes.com
When working in Next.js, do you see a blank page after you programmatically call router.push()?
I had this problem too, and here’s how I solved it.
Don’t write return after calling router.push(), and don’t use it as a return value.
Never use return when you use it.
For example, don’t do this:
router.push('/')
returnAnd don’t do this:
return router.push('/')Do this:
router.push('/')
This content originally appeared on flaviocopes.com and was authored by flaviocopes.com
flaviocopes.com | Sciencx (2022-04-11T05:00:00+00:00) Blank page after router.push() in Next.js?. Retrieved from https://www.scien.cx/2022/04/11/blank-page-after-router-push-in-next-js/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.