Questions tagged [dynamic-routing]
184 questions
31
votes
2 answers
Advantages of dynamic vs static routing in React
I'm reading about static vs dynamic routing in React Router, and I'm struggling to identify the advantages of the latter (and why v4 chose to go with it). I can see the advantage of listing out all the routes for an application (static), as well as…

Voriki
- 1,617
- 2
- 19
- 43
17
votes
1 answer
Next.js nested dynamic folder routing
Update:
Which it causing this error because of [category_slug]-index.js that getServerSideProps?
I tried to do index.js under product folder, it works, mean it okies with [category_slug] which getServerSideprops, am I right?
This is my folder…

Wilker
- 551
- 2
- 6
- 21
12
votes
4 answers
How to do dynamic routes with nextjs 13?
How do we do dynamic routing with layouts in nextjs 13?
I have a directory in the new next pages app in which im trying to do dynamic routing: app/dashboard/[id].jsx, however it does not work with the dashboard layout.
How do I do it? Normal pages…

Vivaan Kumar
- 457
- 3
- 4
- 9
10
votes
1 answer
Dynamically add child routes in Vuejs
According to this official example, we have the ability to add nested/children routes in vuejs. But I cannot find any help/docs around a way to add these children routes dynamically. e.g only add child routes when Parent route is visited.
Currently…

Nexus23
- 6,195
- 9
- 50
- 67
9
votes
5 answers
nextJS SSR useRouter() does not work when refresh page
I am using nextJS SSR in my project. Now when I try to use the following code to get page parameters then it shows undefined.
function About() {
const router = useRouter();
const { plan_id } = router.query;
console.log(plan_id)
}
export…

Nitesh Malviya
- 794
- 1
- 9
- 17
9
votes
1 answer
NextJs and dynamic routes - how to handle the empty parameter scenario?
I'm trying to retrieve the url parameter without using query strings, for example, http://localhost:3000/test/1, this is what I have so far:
Dir structure
test
- [pageNumber].jsx
index.jsx
import React from 'react';
import { useRouter } from…

darksoulsong
- 13,988
- 14
- 47
- 90
7
votes
2 answers
Dynamic Subdomain Routing With NextJS
How can the Dynamic Sub domain routing feature be implementing in NextJS?
Example: If a user comes with username abc in site xyz then he can access his
site on abc.xyz.com
Also, if the user have abc.com domain then he can point abc.com to…

Ank
- 402
- 5
- 12
7
votes
3 answers
Nextjs assets 404 Not Found when using dynamic rouitng while ssr
I had a static folder with an older version of nextjs. I updated my nextjs to use public folder.
"next": "^9.4.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
this is my nextjs config:
const withPlugins = require('next-compose-plugins');
const…

Afsanefda
- 3,069
- 6
- 36
- 76
5
votes
0 answers
next js dynamic page routing working in localhost but giving file not found error in production
This is part of my next js project. This website is running perfectly on localhost but when i deploy it on vercel, the /blogs/book/chapter page is giving me file not found enter image description here500 error.
Hosted Page - Website
Source Code -…

Manav Goyal
- 51
- 5
5
votes
0 answers
Nuxtjs dynamic routes not accepting payload when "full static"
When I run nuxt generate with target: "static" in my nuxt.config.js, my dynamically-created routes do not accept their payload, which they get like so:
****nuxt.config.js****
generate: {
routes() {
return axios
…

sford4
- 51
- 4
5
votes
2 answers
ExpressJS: Adding routes dynamically at runtime
I want to be able to add new routes at runtime without restarting the server with NodeJS & ExpressJS. I made a similiar approach like in this article: https://alexanderzeitler.com/articles/expressjs-dynamic-runtime-routing/Technically I'm able to…

Doodle
- 141
- 2
- 9
5
votes
1 answer
Nuxt generate static site with a fallback file for all dynamic routes
I already searched the whole internet for an answer to my question. No luck so far.
What I want to achieve:
I have a Nuxt application running in Universal mode. It is something like a small social network where users can create their own profiles…

Moritz Laube
- 369
- 4
- 14
4
votes
1 answer
NextJS - Nested routing + subpages with context and layout
I'm currently in the process of migrating one of my react apps to NextJS and am struggling to fit my previous react-router architecture into the nextjs routing.
The page I'm building would look something like this:
When a user goes to a…

user12457151
- 853
- 2
- 12
- 25
4
votes
2 answers
How to make Next.js links dynamic based on current dynamic page?
I am building an LMS using Next.js. So far my project structure is localhost/courses/1. Every course will have 7 pages. Dashboard, Assignment, TestAndQuizzes, Gradebook, Resources, Announcements, and Roster. I have all the components and pages…

SSubedi
- 79
- 1
- 11
4
votes
1 answer
Rewrites not working on Vercel (in production) NextJS
I have been trying to get Rewrites working in NextJS for my API Paths. It was to avoid CORS issues.
I followed the solution from: NextJs CORS issue.
It is working on localhost but does not work in a production environment (I was deploying on Vercel…

Y M
- 2,105
- 1
- 22
- 44