Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I want to do what is stated in the README, render MatButton

src/main.rs

use yew::prelude::*;
use yew::html;
use material_yew::MatButton;

#[function_component]
fn HelloWorld() -> Html {
    html! {<MatButton label="Click me!" />}
}

#[function_component(App)]
fn app() -> Html {
    html! {
        <>
        <h1>{ "Hello World" }</h1>
        <HelloWorld />
        </>
    }
}

fn main() {
    yew::Renderer::<App>::new().render();
}

Cargo.toml

[dependencies]
yew = { version = "0.20", features = ["csr"] }
material-yew = { version = "0.1.0", features = ["full"] }

But I get the following error. How can I fix it? I'm new to yew and don't know if this is a bug, I'm asking in QA.
Thanks in advance

error[E0277]: the trait bound `MatButton: yew::Component` is not satisfied
 --> src/main.rs:7:13
  |
7 |     html! {<MatButton label="Click me!" />}
  |             ^^^^^^^^^ the trait `yew::Component` is not implemented for `MatButton`
  |
  = help: the trait `yew::Component` is implemented for `ContextProvider<T>`
  = note: required for `MatButton` to implement `yew::BaseComponent`
  = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info)
You must be logged in to vote

Replies: 1 comment

Comment options

Sorry, I threw a Question in the wrong repository.
Please forget it.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.