@@ -34,7 +34,7 @@ folder. You can preview them at [this site](https://frender-rs.github.io/frender
3434
3535 ` ` ` toml
3636 [dependencies]
37- frender = " = 1.0.0-alpha.7 "
37+ frender = " = 1.0.0-alpha.8 "
3838 ` ` `
3939
40403. Create ` index.html` in the project root directory.
@@ -177,15 +177,28 @@ def_props! {
177177 pub struct MyProps {
178178 // Required prop
179179 name: String,
180+
180181 // Optional prop which defaults to `Default::default ()`
181- age: Option< u8> ,
182+ // The following property ` age` is optional, and defaults to ` None`
183+ age? : Option< u8> ,
184+
185+ // The following property ` tags` is optional, and defaults to ` Vec::default()`
186+ tags? : Vec< String> ,
187+
182188 // If the prop type is not specified,
183189 // then frender will infer the type by prop name.
184190 // For example, ` class_name` default has type ` Option< String> `
191+ // The following property ` class_name` is optional, has type Option< String>
185192 class_name? ,
193+
194+ // The following property ` id` is required, has type Option< String>
195+ id,
196+
186197 // Prop can also have type generics.
187198 // For example, the following is
188- // the default definition for prop ` children`
199+ // the default definition for prop ` children` ,
200+ // which means it accepts any ` Option< TNode> ` where TNode implements react::Node,
201+ // and then map the value into ` Option< react::Children> ` and store it into MyProps.
189202 children< TNode: react::Node>( value: Option< TNode> ) -> Option< react::Children> {
190203 value.and_then(react::Node::into_children)
191204 },
0 commit comments