Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect, Router.push() problem #479

Closed
khorolets opened this issue Dec 22, 2016 · 6 comments
Closed

Redirect, Router.push() problem #479

khorolets opened this issue Dec 22, 2016 · 6 comments
Assignees

Comments

@khorolets
Copy link

khorolets commented Dec 22, 2016

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!

@manishbalyan
Copy link

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

@timneutkens
Copy link
Member

@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.

@manishbalyan
Copy link

my version is next@latest

@timneutkens
Copy link
Member

@manishbalyan try npm install next@beta, I believe the router api was added in v2.0.0 which is currently in beta.

@manishbalyan
Copy link

thanks @timneutkens but i got new problem after update to beta Cannot read property 'Component' of undefined. any solution

@timneutkens
Copy link
Member

Can you create a new issue for that with an example to reproduce? ❤️

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants