wip: more examples

This commit is contained in:
Jonathan Kelley committed 2021-07-06 12:13:00 -04:00
1 parent 904b26f711
commit 11f89e5d33
27 files changed
+64 -57

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ struct ListItem {
}
fn app(cx: Context<AppProps>) -> VNode {
let (val, set_val) = use_state(&cx, || 0);
let (val, set_val) = use_state_classic(&cx, || 0);
cx.render(LazyNodes::new(move |_nodecx| {
builder::ElementBuilder::new(_nodecx, "div")
+2 -2
View File
@@ -36,7 +36,7 @@ use std::{
/// }
/// }
/// ```
pub fn use_state<'a, 'c, T: 'static, F: FnOnce() -> T>(
pub fn use_state_classic<'a, 'c, T: 'static, F: FnOnce() -> T>(
cx: &impl Scoped<'a>,
initial_state_fn: F,
) -> (&'a T, &'a Rc<dyn Fn(T)>) {
@@ -158,7 +158,7 @@ impl<'a, T: 'static + Display> std::fmt::Display for UseState<T> {
/// }
/// }
/// ```
pub fn use_state_new<'a, 'c, T: 'static, F: FnOnce() -> T>(
pub fn use_state<'a, 'c, T: 'static, F: FnOnce() -> T>(
cx: &impl Scoped<'a>,
initial_state_fn: F,
) -> &'a UseState<T> {