Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@
- ValiantCat
- vdusart
- vesan
- vezaynk
- VictorElHajj
- vijaypushkin
- vikingviolinist
Expand Down
21 changes: 13 additions & 8 deletions docs/api/data-routers/RouterProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ title: RouterProvider

[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.RouterProvider.html)

Initializes a data router, subscribes to its changes, and renders the
Accepts a data router, subscribes to its changes, and renders the
matching components. Should typically be at the top of an app's element tree.

```tsx
import {
RouterProvider,
createBrowserRouter,
} from "react-router";
import { createRoot } from "react-dom/client";
let router = createBrowserRouter();
import { createBrowserRouter } from "react-router";
import { RouterProvider } from "react-router/dom";

let router = createBrowserRouter(routes);

createRoot(document.getElementById("root")).render(
<RouterProvider router={router} />
);
Expand All @@ -31,10 +31,15 @@ createRoot(document.getElementById("root")).render(

[modes: data]

_No documentation_
<docs-warning>This is an implementation detail and shouldn't need to be used in your application.</docs-warning>

This prop provides a way to inject the `react-dom` `flushSync` implementation when running `RouterProvider` in a DOM environment for use during routing operations with `flushSync` enabled (i.e., [useNavigate](../hooks/useNavigate#signature)).

- If you're running `RouterProvider` in a memory environment (such as unit tests) you can import it from `react-router` and omit this prop
- If you are running `RouterProvider` in a DOM environment, you should be importing it from `react-router/dom` which automatically passes the `react-dom` `flushSync` implementation for you

### router

[modes: data]

_No documentation_
The initialized data router for the application.