Skip to content

Using next/router outside of components #17046

Answered by jamesmosier
ezhikov asked this question in Help
Discussion options

You must be logged in to vote

You should be able to import the Router instance and then call Router.push on it via:

import Router from 'next/router'

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
6 replies
@omerman
Comment options

@ryanflowers
Comment options

@sunniejai
Comment options

@JJPell
Comment options

@aryankarim
Comment options

Answer selected by ezhikov
Comment options

You must be logged in to vote
3 replies
@BrightKingsley
Comment options

@Tweedle2Dum
Comment options

@isBatak
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet