@@ -154,7 +154,7 @@ For example, to default a boolean prop to `true`, use the attribute `#[prop_or(t
154
154
is evaluated when the properties are constructed and no explicit value has been given.
155
155
156
156
``` rust
157
- use yew :: {function_component, html, Html , Properties } ;
157
+ use yew :: prelude :: * ;
158
158
159
159
#[derive(Properties , PartialEq )]
160
160
pub struct Props {
@@ -194,7 +194,7 @@ Call `function` to initialize the prop value. `function` should have the signatu
194
194
The function is called when no explicit value has been given for that attribute.
195
195
196
196
``` rust
197
- use yew :: {function_component, html, Html , Properties } ;
197
+ use yew :: prelude :: * ;
198
198
199
199
fn create_default_name () -> AttrValue {
200
200
AttrValue :: Static (" Bob" )
@@ -251,7 +251,7 @@ The macro uses the same syntax as a struct expression except that you can't use
251
251
The type path can either point to the props directly (` path::to::Props ` ) or the associated properties of a component (` MyComp::Properties ` ).
252
252
253
253
``` rust
254
- use yew :: {function_component, html, Html , Properties , props, virtual_dom :: AttrValue } ;
254
+ use yew :: prelude :: * ;
255
255
256
256
#[derive(Properties , PartialEq )]
257
257
pub struct Props {
@@ -262,7 +262,7 @@ pub struct Props {
262
262
}
263
263
264
264
#[function_component]
265
- fn Hello (& Props { name }: & Props ) -> Html {
265
+ fn Hello (& Props { is_loading , ref name }: & Props ) -> Html {
266
266
if is_loading {
267
267
html! { " Loading" }
268
268
} else {
@@ -273,7 +273,7 @@ fn Hello(&Props { name }: &Props) -> Html {
273
273
#[function_component]
274
274
fn App () -> Html {
275
275
// highlight-start
276
- let pre_made_props = props! {
276
+ let pre_made_props = yew :: props! {
277
277
Props {} // Notice we did not need to specify name prop
278
278
};
279
279
// highlight-end
@@ -289,6 +289,7 @@ generate the `Properties` struct for you.
289
289
290
290
``` rust
291
291
use yew :: prelude :: * ;
292
+ use yew_autoprops :: autoprops;
292
293
293
294
// the #[autoprops] macro must appear BEFORE #[function_component], the order matters
294
295
#[autoprops]
0 commit comments