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
#![warn(missing_docs)]
#![doc = include_str!("../README.md")]
#[cfg(doctest)]
#[doc = include_str!("../README.md")]
extern "C" {}
mod builtin_components;
mod component;
mod context;
mod value_container;
mod macros;
mod marker;
mod react_bindings;
mod vnode;
pub mod callback;
pub mod hooks;
pub mod props;
use props::Props;
use wasm_bindgen::prelude::*;
pub use builtin_components::*;
pub use component::*;
pub use context::*;
pub use value_container::*;
pub use marker::*;
#[doc(hidden)]
pub use paste::paste;
pub use vnode::*;
#[doc(hidden)]
#[wasm_bindgen]
pub struct WasmReact;
#[wasm_bindgen]
impl WasmReact {
#[wasm_bindgen(js_name = useReact)]
pub fn use_react(value: &JsValue) {
react_bindings::use_react(value);
}
}
pub fn create_element(
typ: &JsValue,
props: &Props,
children: VNodeList,
) -> VNode {
VNode(react_bindings::create_element(
typ,
props.as_ref(),
&if !children.empty() {
children.into()
} else {
JsValue::undefined()
},
))
}