The URL is a great place to store state in React
13-Mar-2025 95
Here’s what we want to achieve: Let’s say we have a modal (dialog) component that allows the user to perform some important actions which are part of the core flow. We would like the modal to stay open even after the user reloads the page.
If we were to just use useState for the modal open state, we would lose this information when the page reloads. Let’s see how we can solve this problem.
The URL is a great place to store state in React #js #javascript #great #place #store #state #React #react https://javascript.ba/link/the-url-is-a-great-place-to-store-state-in-react