Blank page after router.push() in Next.js?
By Flavio Copes
How to fix the blank page you get after calling router.push() in Next.js: stop using return with it, just call router.push() on its own line and nothing else.
~~~
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('/')
return
And don’t do this:
return router.push('/')
Do this:
router.push('/')~~~
Related posts about next: