Skip to content
This repository has been archived by the owner on Jul 19, 2020. It is now read-only.

Sample app does not work with web-sys #35

Open
thallada opened this issue Mar 3, 2020 · 1 comment
Open

Sample app does not work with web-sys #35

thallada opened this issue Mar 3, 2020 · 1 comment

Comments

@thallada
Copy link

thallada commented Mar 3, 2020

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:

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.

@jstarry
Copy link
Member

jstarry commented Mar 3, 2020

Agreed, would you be willing to make a PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants