Closed Ticsmtc closed 4 years ago
In "Use html!", Elements -> Listeners -> Component Handler
struct MyComponent { link: ComponentLink<Self>, } enum Msg { Click, } impl Component for MyComponent { type Message = Msg; type Properties = (); fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self { MyComponent { link } } fn update(&mut self, msg: Self::Message) -> ShouldRender { match msg { Msg::Click => { // Handle Click } } } fn view(&self) -> Html<Self> { // Create a callback from a component link to handle it in a component let click_callback = self.link.send_back(|_: ClickEvent| Msg::Click); html! { <button onclick=click_callback> { "Click me!" } </button> } } }
will report 2 errors
The first error was very obvious, but I couldn't just &mut self. Because this will directly disrupt the library code.
&mut self
The second error is contained in the macro, so I can't understand it.
By the way , sample code in the second tab Agent Handler seems have the same issue.
Agent Handler
Thanks for the report. This is my bad, the sample contains unreleased functionality. I will fix this evening
Took me a month to fix.. 😅 v0.11 has been released and the sample code should work now
In "Use html!", Elements -> Listeners -> Component Handler
will report 2 errors
The first error was very obvious, but I couldn't just
&mut self
. Because this will directly disrupt the library code.The second error is contained in the macro, so I can't understand it.
By the way , sample code in the second tab
Agent Handler
seems have the same issue.