Expand description
§reView - API Documentation
reView is a Rust library for creating front-end web apps using WebAssembly
- Features a fluent API for declaring interactive HTML with Rust expressions.
- Use a VirtualDOM to minimize DOM API calls for each page render.
reView is not production-ready, and it’s a WIP project so expect breaking changes between versions.
§Supported Targets (Client-Side Rendering)
wasm32-unknown-unknown
§Example
use review::EventType::OnClick;
use review::Tag::{Button, Div};
use review::{callback, children, component, use_state, ElementBuilder, VNode};
#[component(App)]
pub fn app() -> VNode {
let (state, set_state) = use_state(0);
Div.with_children(children!(
format!("Current value {}", state),
Button
.with_child("Increase counter")
.with_event(OnClick, callback!(move || { set_state(*state + 1) }))
))
.into()
}
fn main() {
review::init_logger(review::log::Level::Debug);
review::render(App(()).into(), "root");
}Re-exports§
pub use log;
Macros§
- callback
- This macro is used to declare event for a Tag element using the ElementBuilder API
- children
- This macro helps to declare children for a Tag element using the ElementBuilder API
Structs§
Enums§
- Event
Type - Rappresent all possible js events used in reView
- Tag
- Rappresent all possible tag used in reView
- VNode
- A VNode rappresent a node in the VirtualDOM tree.
Traits§
- Element
Builder - This is the API to declare VNode in reView
Functions§
- init_
logger - Initialize the logger with the specified minimum log log::Level
- render
- Starts a reView app mounted to the element with the specified id.
- use_
effect - The Effect Hook lets you perform side effects in components
- use_
state - This hook is used to manage the state in a component.