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

Sample app does not work with web-sys #35

@thallada

Description

@thallada

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions