12 / 14

Discuss route object?

The objects passed to createBrowserRouter are called Route Objects.

  1. 1

    Component: The Component property in a route object defines the component that will render when the route matches.

  2. 2

    Loader: Route loaders provide data to route components before they are rendered.

  3. 3

    Action: Route actions allow server-side data mutations with automatic revalidation of all loader data on the page when called from <Form>, useFetcher, and useSubmit.

  4. 4

    shouldRevalidate: By default, all routes are revalidated after actions. This function allows a route to opt-out of revalidation for actions that don't affect its data.

  5. 5

    lazy: Most properties can be lazily imported to reduce the initial bundle size.

component:
loader:
action:
shouldRevalidate:
lazy: