question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

github_iconTop GitHub Comments

2reactions
hemscommented, Feb 7, 2022

If you just import “Router” directly instead of “useRouter” won’t that fix the issues?

i.e.

import Router from 'next/router'

Router.whateverYouNeed
2reactions
RenaudRohlingercommented, Feb 5, 2022

Hello!

It is because context is lost through the reconciler. So we have to either way forward it through context bridge or via a state manager such as Zustand.

If that answers your question feel free to close this issue. Maybe we could add a small explanation in the readme

Read more comments on GitHub >

github_iconTop Results From Across the Web

import Router from 'next/router' is it ok? - Stack Overflow
I guess the main suggestion to not use Router.push() or Router.pathname directly from the object itself is because of the way Next.js serves ......
Read more >
Why does React re-render the components multiple times ...
I've minimized unnecessary re-renders by using this approach: const setLoading = useStore.getState().setLoading or something like that. You'd ...
Read more >
next/router | Next.js
useRouter is a React Hook, meaning it cannot be used with classes. You can either use withRouter or wrap your class in a...
Read more >
How to build a route progress bar in Next.js - Skillthrive
Create a progress bar at the top of a Next.js application to let users know ... file is where you'll create the store...
Read more >
Using Zustand in Your Next React Project - This Dot Labs
This article, we will focus more on the practical use of Zustand in a ... @emotion/react @emotion/styled react-icons react-router-dom axios ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found