The ensureIsValidRoute function flattens dynamic routes objects so that only the route prop is used as the url. It would be useful to pass the entire object instead like with static routes, so some additional props could be used in the filter function. The route prop would have to be assigned to a url prop, something like this :
function ensureIsValidRoute(route) {
route = typeof route === 'object' ? route : { url: route }
if(route.route)
route.url = route.route
// force as string
route.url = String(route.url)
return route
}
The
ensureIsValidRoute
function flattens dynamic routes objects so that only the route prop is used as the url. It would be useful to pass the entire object instead like with static routes, so some additional props could be used in the filter function. The route prop would have to be assigned to a url prop, something like this :