yew 0.15.0

A framework for making client-side single-page apps

Yew Framework - API Documentation

Yew is a modern Rust framework for creating multi-threaded front-end web apps with WebAssembly

  • Features a macro for declaring interactive HTML with Rust expressions. Developers who have experience using JSX in React should feel quite at home when using Yew.
  • Achieves high performance by minimizing DOM API calls for each page render and by making it easy to offload processing to background web workers.
  • Supports JavaScript interoperability, allowing developers to leverage NPM packages and integrate with existing JavaScript applications.

Supported Targets

  • wasm32-unknown-unknown
  • wasm32-unknown-emscripten - (feature = "std_web" is required)
  • asmjs-unknown-emscripten - (feature = "std_web" is required)

Important Notes

  • Yew is not (yet) production ready but is great for side projects and internal tools
  • Yew supports both web-sys and stdweb, developers must choose one or the other using the features "web_sys" and "std_web".
  • Building with cargo-web is not supported for web-sys
  • docs are built by default with the "web_sys" feature, for "std_web" docs, visit yew-stdweb


use yew::prelude::*;

struct Model {
link: ComponentLink<Self>,
value: i64,

enum Msg {

impl Component for Model {
type Message = Msg;
type Properties = ();
fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self {
Self {
value: 0,

fn update(&mut self, msg: Self::Message) -> ShouldRender {
match msg {
Msg::AddOne => self.value += 1

fn change(&mut self, _: Self::Properties) -> ShouldRender {

fn view(&self) -> Html {
html! {
<button|_| Msg::AddOne)>{ "+1" }</button>
<p>{ self.value }</p>

# fn dont_execute() {
fn main() {
# }