[][src]Crate yew_macro

This crate provides Yew's procedural macro html! which allows using JSX-like syntax for generating html and the Properties derive macro for deriving the Properties trait for components.

The html! macro uses proc_macro_hack in order to be used in the expression position.

use yew::prelude::*;

#[derive(Properties)]
struct Props {
  #[props(required)]
  prop: String,
};

// ...

html! {
  <div>
    <button onclick=|_| Msg::Submit>{ "Submit" }</button>
    <>
      <Component prop="first" />
      <Component prop="second" />
    </>
  </div>
}

Please refer to https://github.com/yewstack/yew for how to set this up.

Derive Macros

Properties
proc_macro_hack_html