javascriptnode.jsbrowsernext.jsnext-link

Next.js: how to create entry browser history


I have been trying to create an entry in the browser history every time I navigate to a new page in Next.js with the Link property provided by them, but I am not able to push an entry to the browser history, so if I go back one page I am not on the page before on my application, but on the page of whatever else I visited before.

Does anyone know how to implement this functionality in Next.js? Also, I have a node back end, if that is useful in any way.


Solution

  • This is probably the only way I found of creating browser history in nextjs

    React & Next.js — Bug: getting previous page's value from session storage