Expand description
§Stunt Web Framework Documentation
stunt is a frontend web framework for developing reactive user interfaces with Rust.
§Features
- Macro for writing html with rust expressions, similar to that of JSX.
- Highly extensible components.
- Use any build tool you like eg. trunk.
- Multiple ways to manage the state of your application.
§Example
use stunt::prelude::*;
pub enum Message {
Add,
}
pub struct App {
count: usize,
}
impl Component for App {
type Message = Message;
type Properties = ();
fn create() -> App {
App {
count: 0,
}
}
fn callback(&mut self, message: &Message) {
match message {
Message::Add => {
self.count += 1;
},
}
}
fn view(&self, _: ()) -> Html {
html! {
<div>
<button onclick={ Message::Add } >
{ "increment" }
</button>
<h1>
{ self.count }
</h1>
</div>
}
}
}
fn main() {
Renderer::<App>::new().render();
}
Modules§
- component
- This module contains everything related to components.
- console
- Access the browser console.
- global
- Share a mutable value globally across your application. Globals only allow for one value per type, if you want to use multiple values of the same type at the same time you should use a Struct.
- prelude
- Re-export of common types.
- render
- The renderer is the entry point of a stunt application