Question: How to do advanced state management with url search parameter in a transparent manner?



This content originally appeared on DEV Community and was authored by DarkTrick

Use case:

You have a site with a table and a couple of filter options (free text filter, tag filter, date filter) and order options (column x, asc; column y, desc; …).

All those options should reflect onto the url search parameters. The browser back button functionality should work for every changed parameter.

Free text filters or date filters should only update the url search parameters on focus out or /apply filter/, not on every single letter change

Question:

What is a simple and transparent** way to manage this situation? Are there maybe libraries that already do everything?

** By transparent I mean the developer can easily use the approach without the need for thinking about it’s inner workings. No extra special code is needed for input fields.


This content originally appeared on DEV Community and was authored by DarkTrick