silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
167 stars 17 forks source link

Switch to `wouter` for routing #1534

Closed axelboc closed 6 months ago

axelboc commented 6 months ago

React Router is maintained by the people who make Remix, and they're pushing a lot of features related to data fetching and SSR into react-router. It's now similar to the upcoming Tanstack Router in terms of features. Those solutions are probably great to manage routing and data fetching in complex apps, especially when server-side rendering is involved. However, this is not our use case here, so I've been wanting to go back to something simpler, lighter, and focused on front-end routing.

I've come across two promising libraries: type-route and wouter. The former is really appealing, with a focus on type safety. The latter is pretty much what react-router used to be a bunch of versions ago, with the well-established JSX routing syntax, except with some of the kinks resolved (e.g. explicit route nesting, useSearch hook, etc).

I've decided to go with wouter for the H5Web demo, since the use case is so basic and type safety is not critical, and to ease migration. I'll probably try type-route at some point in another project.

The maintainers of wouter have been working on a new major version with much needed improvements to the API. This new major is now at the RC stage, so I've installed the latest RC directly to be able to take advantage of useSearch.