Replies: 8 comments
-
Tried locally and it works exactly as expected:
Can you provide a full repository? |
Beta Was this translation helpful? Give feedback.
-
@timneutkens you are right i also tried it creating new next project and test it I am not able to get this problem but believe me, I am facing this issue in my project I don't know why I can show you this in video |
Beta Was this translation helpful? Give feedback.
-
As asked for please provide a complete reproduction so that we can investigate. |
Beta Was this translation helpful? Give feedback.
-
I Created the reproduction now you visit any URL it will run the [username].js file |
Beta Was this translation helpful? Give feedback.
-
@rizwan92 Thanks! Can you make it public so that I can have a look |
Beta Was this translation helpful? Give feedback.
-
ohh my bad it is public now |
Beta Was this translation helpful? Give feedback.
-
Just tried the repository, it works correctly, same as my earlier reply:
|
Beta Was this translation helpful? Give feedback.
-
watch this video movie and why getInitialProps run Twice in server-side |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
is there any way to create a dynamic route after /
I have created dynamic route inside page directory like below
- [username].js
When someone visits http://mydomain.com/myusername.
I get the username from get initial props and show them relevant content
problem Is when I visit my other routes like /home/preview or /contacts it gives me the right page but [username].js page run as well I have some code that should only run for [username].js not for another route
routes structure
pages
we cannot create dynamic routes for after root
To Reproduce
Create a directory structure like above
query. username
inside get initial props of [username].jslocalhost:3000/myusername
, you will see the log ofmy username
therelocalhost:3000/contact
it will result in you your contacts.js react component but it will also run the [username].js file5 likely you can also visit /home/preview and it will again run the file
Expected behavior
it should not run the [username].js file
Beta Was this translation helpful? Give feedback.
All reactions