Client side routing, query params and static export (NextJS app hosted in Azure blob storage)
Unanswered
Maremmano-Abruzzese Sheepdog posted this in #help-forum
Maremmano-Abruzzese SheepdogOP
Now that I finished my app and deployed it as static website in azure storage ... I hit the issue of client side routing.
My app is not massive, and after reading a bit I think I could rewrite parts of code to account for this. However, Im not sure about what exactly is the right approach.
I understand that I can make separate pages for most things, but what about query params, is there any way I can get the query params or any dynamic data within the url to "go through" ?
Or what are the best approaches to use in this scenario?
For example lets say i have page www.page.com/product
how can I add dynamic data to this page either route or query param or anything else ?
product/12345 (id)
product?id=12345
something like that, I could write some logic in product page to use dynamic data, if it only gets there
EDIT: I did a quick test if I enter a url with query params -> since such static file does not exists I get redirected to index.html. I console logged window.location.search and it does seem that query params are present. I guess thats a way to handle dynamic data with static export.
My app is not massive, and after reading a bit I think I could rewrite parts of code to account for this. However, Im not sure about what exactly is the right approach.
I understand that I can make separate pages for most things, but what about query params, is there any way I can get the query params or any dynamic data within the url to "go through" ?
Or what are the best approaches to use in this scenario?
For example lets say i have page www.page.com/product
how can I add dynamic data to this page either route or query param or anything else ?
product/12345 (id)
product?id=12345
something like that, I could write some logic in product page to use dynamic data, if it only gets there
EDIT: I did a quick test if I enter a url with query params -> since such static file does not exists I get redirected to index.html. I console logged window.location.search and it does seem that query params are present. I guess thats a way to handle dynamic data with static export.