Skip to content

Commit

Permalink
showcase of custom component with default value
Browse files Browse the repository at this point in the history
  • Loading branch information
rambip committed Dec 28, 2023
1 parent a1ef828 commit c44ed65
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/custom_components/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ static MARKDOWN_SOURCE: &str = r#"
<Counter initial="a"/>
<Counter/>
## Here is a Box:
<box>
Expand Down Expand Up @@ -54,7 +56,7 @@ fn App(cx: Scope) -> Element {
components.register(
"Counter",
|cx, props| Ok(render!{
Counter {initial: props.get("initial")?.parse()?}
Counter {initial: props.get_parsed_optional("initial")?.unwrap_or(0)}
})
);

Expand Down

0 comments on commit c44ed65

Please sign in to comment.