Skip to content

Commit

Permalink
replace element= with component= (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
klequis authored Jul 30, 2024
1 parent 75c20c3 commit ab12c15
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/routes/solid-router/advanced-concepts/lazy-loading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import { Router, Route } from "@solidjs/router";

const Home = () => import("./Home");
const Users = lazy(() => import("./Users"));

const App = () => (
<Router>
<Route path="/" element={<Home />} />
<Route path="/users" element={<Users />} />
<Route path="/" component={<Home />} />
<Route path="/users" component={<Users />} />
</Router>
);
```

In the example above, the `Home` component is lazy loaded using the `lazy` function.
The `lazy` function takes a function that returns a promise, which resolves to the component you want to load.
When the route is matched, the component will be loaded and rendered.
When the route is matched, the component will be loaded and rendered.

0 comments on commit ab12c15

Please sign in to comment.