'How to check if useRouter can use router.back() in nextjs app
- I'm using next js for my application and I'm facing some issues with routing to the previous route of the application. I know that there is a function like
router.back(), but I do not know if I can go back from the current page. - I have read that we can check
history.action !== 'POP'but now I check that history has no action property when using console.log(history)
I am using next/router.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
