Skip to content

router.query returns undefined parameter on first render in Next.js #11484

Answered by vassbence
rasperrypie asked this question in Help
Discussion options

You must be logged in to vote

useRouter is a react hook, it catches up to the current query on ReactDOM.hydrate.
You can read more about it here.

Replies: 44 comments 94 replies

Comment options

You must be logged in to vote
19 replies
@treeindev
Comment options

@divofred
Comment options

@JJZFIVE
Comment options

@bezenson
Comment options

@mrdbstn
Comment options

Answer selected by rasperrypie

This comment has been hidden.

@WassimBenzarti
Comment options

Comment options

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

@ahakem
Comment options

@elie222
Comment options

Comment options

You must be logged in to vote
7 replies
@Clariity
Comment options

@logan272
Comment options

@itsinalis
Comment options

@ImtiazNayeemShawon
Comment options

@simbakowo
Comment options

Comment options

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

@pie6k
Comment options

@codeBelt
Comment options

Comment options

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

@dtgreene
Comment options

@gsambrotta
Comment options

@etler
Comment options

@SoloOrchid
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@renatosaz
Comment options

@renatosaz
Comment options

Comment options

You must be logged in to vote
1 reply
@redgumnfp
Comment options

Comment options

You must be logged in to vote
5 replies
@joaobibiano
Comment options

@theZulqarnain
Comment options

@eric-burel
Comment options

@peter-gy
Comment options

@samuelgoldenbaum
Comment options

Comment options

You must be logged in to vote
1 reply
@ardeearam
Comment options

Comment options

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

@obolland
Comment options

@StephenBitmovin
Comment options

@bradenroper
Comment options

@tientaidev
Comment options

Comment options

You must be logged in to vote
9 replies
@goforbg
Comment options

@eric-hc
Comment options

@ggicci
Comment options

@cmaciasjimenez
Comment options

@Aryan-mor
Comment options

Comment options

You must be logged in to vote
1 reply
@f0rr0
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@sannajammeh
Comment options

@huksley
Comment options

Comment options

You must be logged in to vote
2 replies
@ryparker
Comment options

@viclafouch
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

@LunarMelody
Comment options

@ihumentsev
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

@sannajammeh
Comment options

@eqqi33
Comment options

Comment options

You must be logged in to vote
1 reply
@ivan-kleshnin
Comment options

Comment options

You must be logged in to vote
1 reply
@sannajammeh
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ImtiazNayeemShawon
Comment options

@huksley
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet