Docs
API Reference
Functions
defineRouter

defineRouter

defineRouter is an utility function that allows you to define a router by attaching pages to it and setting a layout and other options.

Options

defineRouter accepts an object with the following options:

OptionTypeDescriptionOptional
importsRouterComponent[]An array of other Router classes to be imported.Yes
layoutLayoutComponentThe layout component to be used.Yes
pagesPageComponent[]An array of page components to be used.No
notFoundComponentReact.FCThe 404 page component to be used.Yes
loaderComponentReact.FCThe loader component to be used.Yes

Returned value

defineRouter returns a function that accepts a Router class and returns a new Router instance object with the options defined.

Logo Image