Build Status Gitter chat

Yew

Yew (pronounced /juː/, the same way as "you") is a modern Rust framework inspired by Elm and ReactJS for creating multi-threaded frontend apps with WebAssembly.

The framework supports multi-threading & concurrency out of the box. It uses [Web Workers API] to spawn actors (agents) in separate threads and uses a local scheduler attached to a thread for concurrent tasks.

Become a sponsor on Patreon

Cutting Edge technologies

Rust to WASM compilation

This framework is designed to be compiled into modern browsers' runtimes: wasm, asm.js, emscripten.

To prepare the development environment use the installation instruction here: wasm-and-rust.

Clean MVC approach inspired by Elm and Redux

Yew implements strict application state management based on message passing and updates:

src/main.rs

```rust

[macro_use]

extern crate yew; use yew::prelude::*;

struct Model { }

enum Msg { DoIt, }

impl Component for Model { // Some details omitted. Explore the examples to see more.

type Message = Msg;
type Properties = ();

fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
    Model { }
}

fn update(&mut self, msg: Self::Message) -> ShouldRender {
    match msg {
        Msg::DoIt => {
            // Update your model on events
            true
        }
    }
}

}

impl Renderable for Model { fn view(&self) -> Html { html! { // Render your model here