next-routes
next-routes copied to clipboard
Query String Pattern Matching
Can we do something like
pattern: '/page?action=create'
as opposed to
pattern: '/page/create`
because modals should be a child of the parent component in order to keep the background state, as opposed to creating its own route
From the usage docs of path-to-regexp
Please note: The RegExp returned by path-to-regexp is intended for ordered data (e.g. pathnames, hostnames). It does not handle arbitrary data (e.g. query strings, URL fragments, JSON, etc).
The following are synonymous as I understand it
routes.add('page', '/page')
'/page?action=create'
'/page?action=delete'
routes.add('page', '/page/:action')
'/page/create`
'/page/delete`
const { action } = query
@elkwood the 2nd approach :action creates a new route though