Skip to content

Commit

Permalink
Fix v6 data API migration guideline docs (#11492)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewando committed Apr 24, 2024
1 parent ec03b12 commit dc786c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions contributors.yml
Expand Up @@ -177,6 +177,7 @@
- mikib0
- minami-minami
- minthulim
- mlewando
- modex98
- morleytatro
- ms10596
Expand Down
16 changes: 8 additions & 8 deletions docs/upgrading/v6-data.md
Expand Up @@ -97,7 +97,7 @@ import {

// 3️⃣ Router singleton created
const router = createBrowserRouter([
{ path: "*", Component: Root },
{ path: "*", element: <Root /> },
]);

// 4️⃣ RouterProvider added
Expand Down Expand Up @@ -133,12 +133,12 @@ function UserApp() {

### Start lifting routes and leveraging the data APIs

Let's start with the `/` route for the `<Home>` component. All we need to do is lift the `<Route>` definition up to the data router:
Let's start with the `/` route for the `<Home>` element. All we need to do is lift the `<Route>` definition up to the data router:

```tsx lines=[2,13]
const router = createBrowserRouter([
{ path: "/", Component: Home }, // 🆕
{ path: "*", Component: Root },
{ path: "/", element: <Home /> }, // 🆕
{ path: "*", element: <Root /> },
]);

export default function App() {
Expand All @@ -162,18 +162,18 @@ Now let's look at lifting the Blog App upwards, but still doing it one leaf rout

```tsx lines=[3-12,23,32]
const router = createBrowserRouter([
{ path: "/", Component: Home },
{ path: "/", element: <Home /> },
{
// Lifted blog splat route
path: "/blog/*",
children: [
// New blog index route
{ index: true, Component: () => <h1>Blog Index</h1> },
{ index: true, element: <h1>Blog Index</h1> },
// Blog subapp splat route added for /blog/posts matching
{ path: "*", Component: BlogApp },
{ path: "*", element: <BlogApp /> },
],
},
{ path: "*", Component: Root },
{ path: "*", element: <Root /> },
]);

export default function App() {
Expand Down

0 comments on commit dc786c9

Please sign in to comment.