feat: integrate fermi

This commit is contained in:
Jonathan Kelley committed 2022-02-17 10:38:51 -05:00
1 parent 3873cd1a60
commit d461ffc011
23 files changed
+630 -15

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
use crate::AtomRoot;
use dioxus_core::ScopeState;
use std::rc::Rc;
// Returns the atom root, initiaizing it at the root of the app if it does not exist.
pub fn use_atom_root(cx: &ScopeState) -> &Rc<AtomRoot> {
cx.use_hook(|_| match cx.consume_context::<AtomRoot>() {
Some(root) => root,
None => cx.provide_root_context(AtomRoot::new(cx.schedule_update_any())),
})
}