How can I get history in NextJS? Or just Focus on item I redirected user from when he comes back
I need to focus on the item my user was redirected from to details page when he comes back. To do so I figured I need to have focus func in my general info page (
/users/
) and focus if someone is redirected to it from details page (/user/{id}
). Do I need to get that id to focus on that item?9 Replies
you can pass a query param no?
/user/{id}?focus=something
as example
I thought about that before but I don't like it that much. Although it solves the issue for sure
I thought I could do it without URL params
you can maybe check the history api from the browser
Already done, no luck :c
I can write my own history context and use that but I feel like this is over engineering
maybe proxy the link and add to local storage?
switch from using the next link directly
to a onClick with a custom function
add to local storage and push to next link
GitHub
Retrieve previous route and/or route history in Next router · Discu...
I'm using the router you can retrieve from arguments in _app. In router.route, there is a state object identical with what is shown here (docs). Nowhere do I see any mention of past route r...
I found this but I can wrap my head around this, How am I supposed to implement this?
let me try it
i think i did it
https://next-history.vercel.app
GitHub
GitHub - STNeto1/next-history: next-history
next-history. Contribute to STNeto1/next-history development by creating an account on GitHub.