Use wouter to detect query param changes
Oct 17, 2021
Recently we had a requirement where we needed to synchronise UI state with url changes/updates. To be specific, we wanted to render section by passing it via query params
http://localhost:3000?section=categories // Renders categories componenthttp://localhost:3000?section=detail?name=jack // Renders detail component and name parameter has a value, 'jack'.
It is important to mention at this point that we were using wouter
for routing for our preact
SPA and redux for state management. Looking at out current tech preference, it was obvious we would consider connected-react-router
and we did but not without taking one last look at wouter
hooks based api.
If you like article above, give me a thumbs up. Thanks for reading.