yew-macro 0.13.0

A framework for making client-side single-page apps
Documentation

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.

# #[macro_use] extern crate yew;
use yew::prelude::*;

struct Component {
link: ComponentLink<Self>,
}

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

# enum Msg { Submit }
#
# impl yew::Component for Component {
#     type Message = Msg;
#     type Properties = Props;
#     fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
#         unimplemented!()
#     }
#
#     fn update(&mut self, msg: Self::Message) -> ShouldRender {
#         unimplemented!()
#     }
#
#     fn view(&self) -> Html {
#
// ...

html! {
<div>
<button onclick=self.link.callback(|_| Msg::Submit)>
{ "Submit" }
</button>
<>
<Component prop="first" />
<Component prop="second" />
</>
</div>
}
#
#     }
# }
#
# fn main() {}

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