RouterProvider

Provider for easier handling routing.

The <RouterProvider> is a component from react-aria-components which we expose to give you something on the hand to handle your routes in your application. It can be used to handle your routes if you use Next.js or the React Router.

Import

import { RouterProvider } from '@marigold/components';

Props

PropertyTypeDefaultDescription
childrenReactNodenoneThe children of the component.
navigate(path: string) => voidnoneSet the recived paths where you want to navigate.

Examples

React Router

You can use the provider with the useNavigate hook from react-router-dom. The outcome from the function you can pass into the navigate prop from the <RouterProvider>.

If you want to read more about it visit react arias documentation about it here.

Next.js

Similar to React Router you can pass in the navigate prop the routes you get from the useRouter hook.

Also for more information please visit react arias documentation about it here.