眠気.jl

投稿=不定期

YewでHelloWorld: 備忘録

Yew動かすまでにやったことすべてのメモ

cargo new yewexample
cd yewexample
touch index.html
cargo install --locked trunk

Cargo.toml追記

yew = { git = "https://github.com/yewstack/yew/", features = ["csr"]}

src/main.rsの編集

use yew::prelude::*;

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

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

8080で確認

終わりに

WebGLのexampleとかもあるので面白そうだなとなってます

yew/examples at master · yewstack/yew · GitHub