Skip to content

Commit 15a27ac

Browse files
committed
Various fixes
1 parent 50f3666 commit 15a27ac

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

Cargo.lock

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/website-test/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ wasm-bindgen = "0.2"
1717
wasm-bindgen-futures = "0.4"
1818
weblog = "0.3.0"
1919
yew = { path = "../../packages/yew/", features = ["ssr", "csr"] }
20+
yew-autoprops = "0.3.0"
2021
yew-router = { path = "../../packages/yew-router/" }
2122
tokio = { version = "1.33.0", features = ["rt", "macros"] }
2223

website/docs/concepts/function-components/properties.mdx

+6-5
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ For example, to default a boolean prop to `true`, use the attribute `#[prop_or(t
154154
is evaluated when the properties are constructed and no explicit value has been given.
155155

156156
```rust
157-
use yew::{function_component, html, Html, Properties};
157+
use yew::prelude::*;
158158

159159
#[derive(Properties, PartialEq)]
160160
pub struct Props {
@@ -194,7 +194,7 @@ Call `function` to initialize the prop value. `function` should have the signatu
194194
The function is called when no explicit value has been given for that attribute.
195195

196196
```rust
197-
use yew::{function_component, html, Html, Properties};
197+
use yew::prelude::*;
198198

199199
fn create_default_name() -> AttrValue {
200200
AttrValue::Static("Bob")
@@ -251,7 +251,7 @@ The macro uses the same syntax as a struct expression except that you can't use
251251
The type path can either point to the props directly (`path::to::Props`) or the associated properties of a component (`MyComp::Properties`).
252252

253253
```rust
254-
use yew::{function_component, html, Html, Properties, props, virtual_dom::AttrValue};
254+
use yew::prelude::*;
255255

256256
#[derive(Properties, PartialEq)]
257257
pub struct Props {
@@ -262,7 +262,7 @@ pub struct Props {
262262
}
263263

264264
#[function_component]
265-
fn Hello(&Props { name }: &Props) -> Html {
265+
fn Hello(&Props { is_loading, ref name }: &Props) -> Html {
266266
if is_loading {
267267
html! { "Loading" }
268268
} else {
@@ -273,7 +273,7 @@ fn Hello(&Props { name }: &Props) -> Html {
273273
#[function_component]
274274
fn App() -> Html {
275275
// highlight-start
276-
let pre_made_props = props! {
276+
let pre_made_props = yew::props! {
277277
Props {} // Notice we did not need to specify name prop
278278
};
279279
// highlight-end
@@ -289,6 +289,7 @@ generate the `Properties` struct for you.
289289

290290
```rust
291291
use yew::prelude::*;
292+
use yew_autoprops::autoprops;
292293

293294
// the #[autoprops] macro must appear BEFORE #[function_component], the order matters
294295
#[autoprops]

0 commit comments

Comments
 (0)