Skip to content

Commit 9ebbf99

Browse files
Update build-a-sample-app.mdx (#3423)
* docs: update getting started guide to document both with_props and with_root Clarify that: - with_props() is used to set dynamic properties for the App component - with_root() is used to mount the app to a specific element instead of <body> --------- Co-authored-by: Matt "Siyuan" Yan <mattsy1999@gmail.com>
1 parent 0c77983 commit 9ebbf99

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

website/docs/getting-started/build-a-sample-app.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ that updates its value when clicked. Replace the contents of `src/main.rs` with
9393

9494
:::note
9595
The call to `yew::Renderer::<App>::new().render()` inside the `main` function starts your application and mounts
96-
it to the page's `<body>` tag. If you would like to start your application with any dynamic
97-
properties, you can instead use `yew::Renderer::<App>::with_props(..).render()`.
96+
it to the page's `<body>` tag.
97+
If you would like to start your application with any dynamic properties, you can instead use `yew::Renderer::<App>::with_props(..).render()`.
98+
If you would like to mount your application to a specific element rather than the `<body>` tag, use `yew::Renderer::<App>::with_root(element).render()` where `element` is a `web_sys::Element`.
9899
:::
99100

100101
```rust ,no_run, title=main.rs

0 commit comments

Comments
 (0)