mirror of
https://github.com/leptos-rs/book.git
synced 2025-12-27 11:06:43 -05:00
Clarify note regarding <Routes view=... /> (#214)
This commit is contained in:
@@ -91,7 +91,7 @@ The `view` is a function that returns a view. Any component with no props works
|
|||||||
</Routes>
|
</Routes>
|
||||||
```
|
```
|
||||||
|
|
||||||
> `view` takes a `Fn() -> impl IntoView`. If a component has no props, it can be passed directly into the `view`. In this case, `view=Home` is just a shorthand for `|| view! { <Home/> }`.
|
> `view` takes a `Fn() -> impl IntoView`. If a component has no props, it can be passed directly into the `view`. In this case, `view=Home` is just a shorthand for `view=|| view! { <Home/> }`.
|
||||||
|
|
||||||
Now if you navigate to `/` or to `/users` you’ll get the home page or the `<Users/>`. If you go to `/users/3` or `/blahblah` you’ll get a user profile or your 404 page (`<NotFound/>`). On every navigation, the router determines which `<Route/>` should be matched, and therefore what content should be displayed where the `<Routes/>` component is defined.
|
Now if you navigate to `/` or to `/users` you’ll get the home page or the `<Users/>`. If you go to `/users/3` or `/blahblah` you’ll get a user profile or your 404 page (`<NotFound/>`). On every navigation, the router determines which `<Route/>` should be matched, and therefore what content should be displayed where the `<Routes/>` component is defined.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user