ASI would rather use existing library, implementing it from scratch surely educational but isn't easy. For example https://github.com/asmyshlyaev177/state-in-urlComment·Article·Nov 8, 2024·How to Lift Component State to the URL in Next.js/React.js
ASCan use my library for that "asmyshlyaev177/state-in-url" , recently updated to support react-routerComment·Article·Oct 9, 2024·Mastering State Management in React Router: Storing and Retrieving State in URLs