Closed levu304 closed 2 years ago
Hi @levu304! Thanks for reporting it — it looks like, for dynamic pages, the param comes undefined as it's not resolved in the router state. It changes to the proper value after it's resolved.
Ok, so turns out it's actually a React limitation — the page is statically rendered and when you see undefined
for the first time, it's the pre-rendered version without the information about the URL. Then once it comes online it changes the value to the proper one. You can add an if
statement in your code to handle that. I'm going to close this issue, feel free to reach out if you have any questions.
What is the problem?
Hi, i'm new in Blitz, when i'm trying dynamic page and using useParam to get parameter from URL, it's return undefined. Is it a bug? See attach image below
Paste all your error logs here:
Paste all relevant code snippets here:
What are detailed steps to reproduce this?
Run
blitz -v
and paste the output here:Please include below any other applicable logs and screenshots that show your problem: