I know the Cargo.toml there says to install yew with the std-web feature, but I thought I could copy the code and it would work in web-sys too. When I tried that I got:
error[E0432]: unresolved import `yew::ClickEvent`
--> src/lib.rs:4:27
|
4 | use yew::{html, Callback, ClickEvent, Component, ComponentLink, Html, ShouldRender};
| ^^^^^^^^^^ no `ClickEvent` in the root
error[E0282]: type annotations needed
--> src/lib.rs:30:37
|
30 | onclick: link.callback(|_| Msg::Click),
| ^ consider giving this closure parameter a type
error: aborting due to 2 previous errors
I was able to fix it by replacing every reference to ClickEvent with MouseEvent.
I think it would be great to either add a version of the code that works in web-sys on that page or make a separate "Sample app" page for web-sys.
I'm talking about the code on this page: https://yew.rs/docs/getting-started/build-a-sample-app
I know the
Cargo.toml
there says to install yew with the std-web feature, but I thought I could copy the code and it would work in web-sys too. When I tried that I got:I was able to fix it by replacing every reference to
ClickEvent
withMouseEvent
.I think it would be great to either add a version of the code that works in web-sys on that page or make a separate "Sample app" page for web-sys.