({ path, nest, match, ...renderProps })
| 238 | } |
| 239 | |
| 240 | export const Route = ({ path, nest, match, ...renderProps }) => { |
| 241 | const router = useRouter(); |
| 242 | const [location] = useLocationFromRouter(router); |
| 243 | |
| 244 | const [matches, routeParams, base] = |
| 245 | // `match` is a special prop to give up control to the parent, |
| 246 | // it is used by the `Switch` to avoid double matching |
| 247 | match ?? matchRoute(router.parser, path, location, nest); |
| 248 | |
| 249 | // when `routeParams` is `null` (there was no match), the argument |
| 250 | // below becomes {...null} = {}, see the Object Spread specs |
| 251 | // https://tc39.es/proposal-object-rest-spread/#AbstractOperations-CopyDataProperties |
| 252 | const params = useCachedParams({ ...useParams(), ...routeParams }); |
| 253 | |
| 254 | if (!matches) return null; |
| 255 | |
| 256 | const children = base |
| 257 | ? h(Router, { base }, h_route(renderProps, params)) |
| 258 | : h_route(renderProps, params); |
| 259 | |
| 260 | return h(ParamsCtx.Provider, { value: params, children }); |
| 261 | }; |
| 262 | |
| 263 | export const Link = forwardRef((props, ref) => { |
| 264 | const router = useRouter(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…