Skip to content

What is the purpose and use case for router.isReady() ... #2118

Closed Answered by posva
michealroberts asked this question in Help and Questions
Discussion options

You must be logged in to vote

From docs:

Returns a Promise that resolves when the router has completed the initial navigation, which means it has resolved all async enter hooks and async components that are associated with the initial route. If the initial navigation already happened, the promise resolves immediately.

This is useful in server-side rendering to ensure consistent output on both the server and the client. Note that on server side, you need to manually push the initial location while on client side, the router automatically picks it up from the URL.

When the router is created it starts in a nowhere location. Depending on the environment (e.g. browser or not), it automatically picks up the location and i…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants