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

This macro is used to declare event for a Tag element using the ElementBuilder API
This macro helps to declare children for a Tag element using the ElementBuilder API

Structs

A VElement is a particulat type of VNode generated from a Tag

Enums

Rappresent all possible js events used in reView
Rappresent all possible tag used in reView
A VNode rappresent a node in the VirtualDOM tree.

Traits

This is the API to declare VNode in reView

Functions

Initialize the logger with the specified minimum log log::Level
Starts a reView app mounted to the element with the specified id.
The Effect Hook lets you perform side effects in components
This hook is used to manage the state in a component.

Type Definitions

The type returned from a use_state hook

Attribute Macros

This attribute creates a component from a normal Rust function.
This attribute creates a user-defined hook from a normal Rust function.