Hi, guys! Can you help me?
I'm using the latest 2.0.0-beta.1 version. And I'm trying to use this section of README to implement a redirect.
My code is:
import Router from 'next/router'
export default () => (
Router.push('/auth/signin')
)
And I'm getting error:
TypeError: _router2.default.push is not a function
Also, I've tried to use .replace with the same result.
Can you help me to understand is this a bug or I'm using it wrong?
Thank you!
i am workin with latest release of next.js but my router is not working, showing errorTypeError: _router2.default.push is not a function(). help me how to fix it , not getting how to fix with #480 issue
@manishbalyan can you make sure you're using next@beta instead of next in your project dependencies? You can check this in ./node_modules/next/package.json.
my version is next@latest
@manishbalyan try npm install next@beta, I believe the router api was added in v2.0.0 which is currently in beta.
thanks @timneutkens but i got new problem after update to beta Cannot read property 'Component' of undefined. any solution
Can you create a new issue for that with an example to reproduce? 鉂わ笍
Most helpful comment
@manishbalyan can you make sure you're using
next@betainstead ofnextin your project dependencies? You can check this in./node_modules/next/package.json.