Questions tagged [nextjs-dynamic-routing]

In Next.js, dynamic routes are defined by placing the parameter inside square brackets ([]) in the page file name. For example, if you have a dynamic route for displaying a user's profile, you can create a file called [username].js. The username inside the brackets is the parameter that will be used to generate dynamic pages.

To handle dynamic routes, Next.js provides a special component called getServerSideProps or getStaticProps. These functions allow you to fetch data based on the dynamic parameter and pass it as props to the page component.

188 questions
0
votes
2 answers

Dynamic Links are not passing props redirected components while routing in nextjs13

I'm learning nextjs using book "Building React Apps using server-side rendering" In this I'm building basic react app with index page link to about page. The project package.json - { "name": "my-next-app", "version": "1.0.0", "description":…
user51
  • 8,843
  • 21
  • 79
  • 158
0
votes
0 answers

Dynamic routes next.js + nginx proxy

When opening page with route /markets/[coinId] on production through domain name, I'm getting error 404. File: _next/static/chunks/pages/market/%5BcoinId%5D-f8020cad1ec98b8a.js When opening same page on production through IP address with port 3000,…
0
votes
1 answer

NextJS 13.4.7 (app routes) Dynamic routes 404 status code

I'm currently building a NextJS 13.4.7 application with dynamic routes and a Headless cms coming from Contentful. All routes are open to use, as you can see in the screenshot below. We want to get the data from the CMS. If there is no data for this…
0
votes
0 answers

NextJS 13 revalidate ISR on-demand not working in production (self hosted)

I have two problems with NextJS, both are connected I believe. both work fine on my local Windows machine, but not on the production server (Digital Ocean droplet Nginx + NextJS) res.revalidate('/blog/post-1') returns Error: Invalid response 404 I…
0
votes
0 answers

NextJS 13.4 App router why is not-found considered a dynamic component

I'm using NextJS 13.4 with app router. My not found page is located in /app/not-found.tsx which works fine in development. The content of the page is below: import { HOMEPAGE_ROUTE } from "../consts/routes"; import Link from "next/link"; const…
OliB
  • 104
  • 1
  • 5
0
votes
1 answer

How to pass data to a server side component in nextjs

I am creating a website for dynamics blogs where i have to pass params to API URL to get a specific blog. I can't use localstorage or cookies or any client side method to block seo. So how can I pass data to a server component from a different…
kalim
  • 1
  • 2
0
votes
1 answer

Next.js, how to eagerly fetch page (traditional pages router)

I have a Next.js app using next 13.4.13. I am using the traditional pages directory. The app has 2 pages. The directory looks like this: /pages/light /pages/heavy The light page is very small, it just has a basic form on it. The heavy page is very…
Jar
  • 1,766
  • 1
  • 21
  • 27
0
votes
0 answers

How do I get the searchParams from the requested url in server side next js 13?

I am working on a multilingual next js 13 app with "app directory". I have a page like "/products", where I will be filtering the page data with URLSearchParams. I have created a client side component for filtering the data in a separate file. I am…
0
votes
0 answers

NextJS - specifying tags and revalidate when fetching - what takes precedence?

revalidateTag('mytag') doesn't seem to work if I fetch() like this: const res = await fetch(url, { next: { tags: ['mytag'], revalidate: 3600 } }) I would expect it to revalidate even if the revalidate interval hasn't passed yet. Right now I have to…
Nightwolf
  • 4,495
  • 2
  • 21
  • 29
0
votes
0 answers

Dynamic routing in nextjs 13

I want to develop a route which catches multiple parameters in a single route in nextjs 13 for SEO. One of the sample route is: /how-to-decide-which-{profession}-to-choose-after-{degree} I have checked the documentation of nextjs 13 and did not…
Aditya
  • 362
  • 2
  • 12
0
votes
0 answers

Dynamic Routing not working after build on NextJS 13

I am trying to simply show dynamic route pages using the new NextJS 13 Page Router system. It works on dev but after build and serve*ing it locally it throws me a 404 page not found . Folder Structure dynamic page content terminal local deploy…
0
votes
1 answer

Dynamic routing using NextJS inside Mantine React Table

I have a Mantine React Table containing some loaded in data and I am trying to apply dynamic routing to the first column of the data, such that every value links to a different URL. Basically to '/test/{value}', where value are the values inside the…
0
votes
0 answers

Page caching preventing middleware to check blacklisted user

I am trying to logout users that is blocked by admin wh If the user is not logged in and is blacklisted by admin then he is unable to log in this is done but what I want is if user is already logged in and admin block that user the subsequent…
0
votes
0 answers

getInitalProps not working in nextjs page

I have created client side pages using getStaticProps on my Next js application. Now I am creating some server side pages on that using getInitialProps but this is not working , because I am using 'next export' in my package.json.Anyone worked on …
0
votes
0 answers

how do i get query parameter in NextJs13 dynamic api routing

i have tried a lot of different ways and i can't seem to get adequation documentation on this I am try to to fetch this URL /api/stripe/${sessionId} to the server-side API path that looks like this api/stripe/[session]/route.js and retrieve the…