CodePark/ questions / State & data-fetching architecture
START PRACTICINGPRACTICE
Frontend question · Frontend system design › State & data-fetching architecture

On a product listing page, users want to share a link that reproduces their current filters, sort order and page. Where should that state live?

In the URL query string

Filters, sort order and page belong in the URL query string. URL state survives a reload, works with the back and forward buttons, and can be shared as a link. That is exactly what these need. "In a global client store such as Redux" is the tempting wrong answer. A global store, like React context, loses the state on reload and cannot be shared by link.