diff --git a/packages/hooks/src/lib.rs b/packages/hooks/src/lib.rs index fd5b7ae45..ff0033e49 100644 --- a/packages/hooks/src/lib.rs +++ b/packages/hooks/src/lib.rs @@ -84,9 +84,6 @@ pub use use_effect::*; mod use_memo; pub use use_memo::*; -// mod use_on_create; -// pub use use_on_create::*; - mod use_root_context; pub use use_root_context::*; diff --git a/packages/hooks/src/use_on_create.rs b/packages/hooks/src/use_on_create.rs deleted file mode 100644 index 36d3345e4..000000000 --- a/packages/hooks/src/use_on_create.rs +++ /dev/null @@ -1,27 +0,0 @@ -use dioxus_core::ScopeState; -use std::cell::Cell; -use std::future::Future; - -/// A hook that runs a future when the component is mounted. -/// -/// This is just [`use_effect`](crate::use_effect), but with no dependencies. -/// If you have no dependencies, it's recommended to use this, not just because it's more readable, -/// but also because it's a tiny bit more efficient. -pub fn use_on_create(future: impl FnOnce() -> F) -where - T: 'static, - F: Future + 'static, -{ - let needs_regen = cx.use_hook(|| Cell::new(true)); - - if needs_regen.get() { - // We don't need regen anymore - needs_regen.set(false); - - let fut = future(); - - cx.push_future(async move { - fut.await; - }); - } -} diff --git a/packages/hooks/src/use_on_destroy.rs b/packages/hooks/src/use_on_destroy.rs index 0a687910d..429acaeca 100644 --- a/packages/hooks/src/use_on_destroy.rs +++ b/packages/hooks/src/use_on_destroy.rs @@ -1,10 +1,6 @@ use dioxus_core::prelude::use_drop; -#[deprecated( - note = "Use `use_on_destroy` instead, which has the same functionality. \ -This is deprecated because of the introduction of `use_on_create` which is better mirrored by `use_on_destroy`. \ -The reason why `use_on_create` is not `use_on_mount` is because of potential confusion with `dioxus::events::onmounted`." -)] +#[deprecated(note = "Use `use_drop` instead, which has the same functionality.")] pub fn use_on_unmount(destroy: D) { use_drop(destroy); }