use crate::{
props::{HType, H},
react_bindings, VNodeList,
};
use std::borrow::Cow;
use wasm_bindgen::JsValue;
#[derive(Debug, Default, Clone, Copy)]
pub struct Fragment;
impl HType for Fragment {
fn as_js(&self) -> Cow<'_, JsValue> {
Cow::Borrowed(&react_bindings::FRAGMENT)
}
}
impl Fragment {
pub fn new() -> H<Fragment> {
H::new(Fragment)
}
}
#[derive(Debug, Default, Clone, Copy)]
pub struct Suspense;
impl HType for Suspense {
fn as_js(&self) -> Cow<'_, JsValue> {
Cow::Borrowed(&react_bindings::SUSPENSE)
}
}
impl Suspense {
pub fn new() -> H<Suspense> {
H::new(Suspense)
}
}
impl H<Suspense> {
pub fn fallback(self, children: VNodeList) -> Self {
self.attr("fallback", children.as_ref())
}
}