molefrog / wouter

šŸ„¢ A minimalist-friendly ~2.1KB routing for React and Preact

Home Page:https://npm.im/wouter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v3.0.0-rc.1: `useRoute` should allow `nest` option just like `<Route />`

happenslol opened this issue Ā· comments

Right now, it's not possible to get the same behavior from useRoute as you would from <Route nest />, instead I have to do the following:

const [match] = useRoute("/route")
const [nestedMatch] = useRoute("/route/:rest*")
const isNestedMatch = match || isNestedMatch

By simply allowing to pass the parameter in an options object or providing an additional useNestedRoute, this would be a lot cleaner.

Alright, I've used rc.2 for a bit now, and I understand that it's now possible to use something like useRoute("/route/*?") to match nested routes, so I think that covers my use case.