docs: move reference up a level
This commit is contained in:
1 parent
f8e569a8be
commit
1464d2e0a7
24 files changed
+1
-1
No files matched your search
@@ -0,0 +1,25 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus::ssr;
|
||||
|
||||
pub static Example: FC<()> = |cx, props| {
|
||||
let as_string = use_state(cx, || {
|
||||
// Currently, SSR is only supported for whole VirtualDOMs
|
||||
// This is an easy/low hanging fruit to improve upon
|
||||
let mut dom = VirtualDom::new(SomeApp);
|
||||
dom.rebuild();
|
||||
ssr::render_vdom(&dom, |c| c)
|
||||
});
|
||||
|
||||
cx.render(rsx! {
|
||||
div { "{as_string}" }
|
||||
})
|
||||
};
|
||||
|
||||
static SomeApp: FC<()> = |cx, props| {
|
||||
cx.render(rsx! {
|
||||
div { style: {background_color: "blue"}
|
||||
h1 {"Some amazing app or component"}
|
||||
p {"Things are great"}
|
||||
}
|
||||
})
|
||||
};
|
||||
Reference in new issue
Block a user