1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! # 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
//!
//! ```rust,no_run
//! 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");
//! }
//! ```
pub use *;
pub use *;
pub use *;
pub use FiberId;
pub use HookContext;
pub use *;
pub use *;
pub use *;
pub use *;
pub use log;
pub use Closure;
extern crate review_macro;
/// This attribute creates a component from a normal Rust function.
///
/// Functions with this attribute must return a [VNode] and can optionally take an argument for props.
/// Note that the function only receives a reference to the props.
///
/// When using this attribute you need to provide a name for the component: `#[component(ComponentName)]`.
/// The attribute will then automatically create a Component with the given identifier which you can use like a normal struct.
///
/// # Example
/// ```rust
/// # use review::{component, ElementBuilder};
/// # use review::Tag::P;
/// # #[derive(Debug)]
/// # pub struct Props {};
/// #[component(Board)]
/// pub fn board(props: &Props) -> VNode {
/// P.with_child(format!("{:?}", props)).into()
/// }
/// ```
pub use component;
/// This attribute creates a user-defined hook from a normal Rust function.
///
/// Function with this attribute must have a name starting with `use_`. Without using
/// this attribute the function could not use the predefined hooks.
///
/// # Example
/// ```rust
/// # use review::{hook, State, use_state, use_effect, log};
/// #[hook]
/// pub fn use_example() -> State<u32> {
/// let (c, set_c) = use_state(5);
/// use_effect(
/// {
/// let c = c.clone();
/// move || {
/// log::info!("{}", c);
///
/// None::<fn()>
/// }
/// },
/// Some(c.clone()),
/// );
///
/// (c, set_c)
/// }
/// ```
pub use hook;