added better documentation and code snipppets for the use_resource, use_future, use_effect and use_context hooks

This commit is contained in:
andrey committed 2024-02-27 10:36:05 +08:00
1 parent 24ebc1e628
commit 5a73147d69
3 files changed
+10 -7

No files matched your search

+5 -2
View File
@@ -45,8 +45,11 @@ pub fn use_context<T: 'static + Clone>() -> T {
// This component does read from the signal, so when the signal changes it will rerun
///#[component]
///fn Child() -> Element {
/// let signal: Signal<i32> = use_context();
/// rsx! { "{signal}" }
/// let signal: Signal<i32> = use_context();
/// rsx! {
/// button { onclick: move |_| signal += 1, "increment context" }
/// p {"{signal}"}
/// }
///}
/// ```
pub fn use_context_provider<T: 'static + Clone>(f: impl FnOnce() -> T) -> T {