next/router is a library provided by Next.js. Use this tag if you need help with the useRouter hook, the withRouter HOC, or with the extracted information from the router object.
Questions tagged [next-router]
293 questions
0
votes
1 answer
Issue with LinkedInBot accessing dynamic URLs incorrectly
I'm currently facing an issue with the LinkedInBot (tool used for linkedin when you try to share one page on their platform) not accessing the dynamic URLs correctly in my Next.js application hosted on Vercel. Instead of accessing the expected URL…

Vítor Norton
- 408
- 1
- 6
- 12
0
votes
0 answers
getStaticPaths not recognizing new routes from database in NextJS
I have a NextJS website where I'm using getStaticPaths to generate the routes for a page. It fetches the paths from a database. The problem is that when I add a new route to the database, it doesn't recognize the new route and gives a 404…

Vítor Norton
- 408
- 1
- 6
- 12
0
votes
0 answers
same route on role-based on nextjs
I am creating a app on nextjs . my folder structure is this . the problem i am facing and as i am new to this nextjs . there is button in header category. when logged in i will get role on my response. when logged in as user it should show…

kriti
- 1
- 2
0
votes
0 answers
in next 13 query params setting doesnt work
import React, { FC, useState } from "react";
import Pagination from "@mui/material/Pagination";
import Stack from "@mui/material/Stack";
import { useSearchParams } from "next/navigation";
interface PaginationComponentProps {
data:…

kholio mudrich
- 1
- 2
0
votes
0 answers
Approach for Handling Dynamic Routes in Role-Based Authentication in NextJS
I am new to nextJS, and I want to build a nextJS application with role-based authentication, In order to do role-based authentication, I have used the Higher-Order Component that component checks whether the user has access to access the pages. In…

Gibson
- 82
- 7
0
votes
0 answers
Orphaned Pages in NextJS using
A recent SEM Rush report indicated thousands of orphaned pages on this site. Much must be due to the fact that we use infinite scroll, no static pagination or index page. However, I would like to know if it is possible that the robots do not…

Lucas Gabardo
- 49
- 3
0
votes
0 answers
How can I handle dynamic routes in role-based authentication using Next.js?
I am new to nextJS (version: 13.4), and I want to use role-based authentication in my nextJS application, So in order to do that, I am using a higher-order component. In my scenario, I am able to handle only the static page route but I don't know…

Gibson
- 82
- 7
0
votes
1 answer
Nextjs: show not-found page when handle in middleware using app dir
I have a nextjs using app dir.
The app suport multi language: /[lang]/.
The [lang] is reqiured for all route and only have some language.
I want to validate the [lang] is correct. If not, show not-found.tsx.
The app support not-found.tsx so…

kan
- 73
- 6
0
votes
1 answer
Nextjs: Is posible to pass object when router.push() using app dir?
I create an Nextjs app using /app dir.
I create multi language for my app, and a button to switch language.
'use client'
import { useParams, usePathname, useRouter } from 'next/navigation'
import { language } from '~/helper/data/common'
function…

kan
- 73
- 6
0
votes
1 answer
Is using a loader the right approach to prevent unauthorized page access in a role-based Next.js application?
I am new to nextJS, and I want to create a role-based application I have used the App route with nextJS's latest version(13.4) in that application, So that I did the role-based authentication using a higher-order component, In my scenario when an…

Gibson
- 82
- 7
0
votes
1 answer
Getting the slug info of a dynamic page without useRouter in nextJS
I'm trying to create two constants that contain the slug information from my dynamic page, but apparently useRouter from next/router has been thrown out of nextJS support. Would any of you know how to do this from here? I saw searchParams but that…

Rick
- 11
- 2
0
votes
0 answers
queries gone when refresh the page when using router.push and "as"
router.push(
{
pathname: "/pages/service-request/",
query: { service: serviceId, city: city,order:orderRes.id,orderservice:res.id },
},
"/pages/service-request/"
);
component b:
export default…
0
votes
0 answers
next/router back is not updating DOM when module federation component is dynamically imported
I am trying to implement a importing a react app, built using CRACO, into a nextjs app. I have tried multiple different implementations, but cannot get the import to work as a module import. I have pulled in…
0
votes
1 answer
How to get referrer value in NextJS?
I am using NextJS routing, but when I try to use document.referrer in my code, it does not return any value. How can I resolve this issue?
I am using the router.events.on method to listen for changes in navigation, but I haven't found a way to…

Vishal
- 17
- 6
0
votes
1 answer
NextJS 13.4, useRouter() is not working | pathname is undefined
I am trying to make an active link and change the styling to underline when it's active. I am using useRouter() from 'next/navigation', because importing useRouter from 'next/router' gives an error. But my link is still not working.
Here's my…

Ali Bin Naseer
- 113
- 2
- 8