Closed mojtabahub closed 3 years ago
This might be due to next routing not including the params on the first render. Please try importing router = useRouter()
from next/router
, and try to log router.query
to see what you get.
Thank you so much, it solved
I have another question how can get current routeName, when i navigate to page i want get current routeName, I need it for anroid app, how can get that?
thanks
If you want it on web, it's .pathname
. This isn't an option on native, you should use dangerouslyGetNavigationState
.
Thank you @nandorojo
Hello,
I use Link like this: <Link web={{ as: "/sell/SM-S-589251/", path: "/sell" }} routeName="sell" >Sell
when i click on Sell i will navigate to sell page successfully. but when i refresh the browser page i get 404 error: This page could not be found.
as i understand the Sell page is in root dictionary and when i refresh browser, browser can't find the page at /sell/SM-S-589251/ URL.
is there any way to solve that?
thanks
It's because of the as
prop. You need to add a page in the sell
folder, such as sell/[id]
.
Then, in Link
, add params={{ id: some-string }}
.
You should read about next routing from their docs to better understand how it works.
Hello,
is there anyway to open Link in web browser blank tab?
Thanks
Hello,
I can send Link params successfully but when i refresh page on browser, i can't get params and i get "Tried to get param page but it does not exist" error on console
how can get params after refresh page?
thanks