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
Next.js, can not navigate after the update to 9.4 version
After update my Next.js app to 9.4 version I can't navigate to my route.
Working only main page '/' (index.js). Everything worked very well before.
Now, when I run my app the terminal show this terminal info and, when I want to go for example to…

Bartłomiej Olech
- 25
- 5
-1
votes
1 answer
Page routing through dropdown (NEXT.js)
I want to route to different pages through dropdown selection. I'm new to react & next, and i have no idea how to do it.
"use client"
import Link from 'next/link';
function Home() {
return (
Hello
-1
votes
2 answers
NextJS router.query not giving the ID param
I am making crud using nextjs as frontend and CodeIgniter as backend I am following a tutorial where the frontend is reactjs. in reactJs when the updating part of the crud comes we can use the react-router-dom useParam function to get the ID but in…

Ghulam Mustafa
- 102
- 14
-1
votes
1 answer
router.query returning an empty object in next js
my folder structure:
also my code:
const router = useRouter();
const { id } = router.query;
so the problem is the id is returning {} and is not returning the id in the URL. it works fine when I put it in jsx but not when I put it in js

Shahab Athar
- 110
- 1
- 3
- 14
-1
votes
1 answer
How can I change isLogin before mounting?
import Router from 'next/router';
class App extends NextApp {
constructor(props) {
super(props);
this.state = {
isLogin: false
}
}
componentDidMount() {
if (JSON.parse(sessionStorage.getItem("APIKEY"))) {
…

Erfuun Ghayoomi
- 21
- 3
-2
votes
1 answer
Why getting Uncaught Error: Hydration failed because the initial UI does not match what was rendered on the server
I have a main layout which is rootLayout. And now i create the layout for blog which is BlogLayout but i don't know why i'm getting the errors. Is there a way to fix them ?

sohaib
- 574
- 5
- 16
-3
votes
1 answer
What are some effective approaches for implementing protected routes using Next.js app router?
I'm working on enhancing the security of my Next.js application by implementing protected routes. I'd like to hear about different strategies or approaches that developers have found successful when using the Next.js app router. I understand that…

Ehtisham Ali
- 1
- 2