Skip to contents

Usage

useRoutes(..., routes = NULL)

Arguments

...

Route elements describing the route tree. Ignored if routes is supplied.

routes

Optional. A JS expression evaluating to a plain JavaScript array of route objects (e.g. JS("[\{ path: '/', element: ... \}]")), used in place of Route() children.

Details

Builds a route tree from Route children (or a plain object routes array) and renders the matched route. The hook-based equivalent of Routes / createRoutesFromElements for code that prefers a configuration-as-data style. Must be called inside a router (RouterProvider, HashRouter, etc.).