Skip to content

Commit

Permalink
fix doc test in website-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldSEnder committed May 15, 2022
1 parent 42e1a0c commit 3eeae19
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions website/docs/advanced-topics/struct-components/refs.mdx
Expand Up @@ -20,6 +20,7 @@ reference in your `html!`. The referenced component can `bind` a value in its cr

```rust
use yew::prelude::*;
use yew::html::BindableRef;

struct Example;

Expand All @@ -31,22 +32,22 @@ impl ComponentWithRef for Example {

fn create(_ctx: &Context<Self>, bindable_ref: BindableRef<'_, Self::Reference>) -> Self {
// highlight-next-line
bindable_ref.bind("My first bound value");
bindable_ref.bind("My first bound value".to_string());
Self
}

fn view(_ctx: &Context<Self>) -> Html {
fn view(&self, _ctx: &Context<Self>) -> Html {
html! {
<p>{"Unimportant content"}</p>
}
}
}

// highlight-start
let comp_ref = ComponentRef<Example>::new();
let comp_ref = ComponentRef::<Example>::new();
html! {
<Example ref={&comp_ref} />
}
};
// highlight-end
```

Expand Down

0 comments on commit 3eeae19

Please sign in to comment.