fix peek() example (#3375)
Co-authored-by: Anatol Ulrich <e+github@mail.taugt.net>
This commit is contained in:
1 parent
040dc54200
commit
0596e53eb5
1 file changed
+3
-2
@@ -139,8 +139,8 @@ pub trait Readable {
|
|||||||
/// let doubled = use_memo(move || {
|
/// let doubled = use_memo(move || {
|
||||||
/// // We want to log the value of the event_source, but we don't need to rerun the doubled value if the event_source changes (because the value of doubled doesn't depend on the event_source)
|
/// // We want to log the value of the event_source, but we don't need to rerun the doubled value if the event_source changes (because the value of doubled doesn't depend on the event_source)
|
||||||
/// // We can read the value with peek without subscribing to updates
|
/// // We can read the value with peek without subscribing to updates
|
||||||
/// let click_count = count.peek();
|
/// let source = event_source.peek();
|
||||||
/// tracing::info!("Click count: {click_count:?}");
|
/// tracing::info!("Clicked: {source:?}");
|
||||||
/// count() * 2
|
/// count() * 2
|
||||||
/// });
|
/// });
|
||||||
/// rsx! {
|
/// rsx! {
|
||||||
@@ -149,6 +149,7 @@ pub trait Readable {
|
|||||||
/// button {
|
/// button {
|
||||||
/// onclick: move |_| {
|
/// onclick: move |_| {
|
||||||
/// event_source.set(Some("Click me button"));
|
/// event_source.set(Some("Click me button"));
|
||||||
|
/// count += 1;
|
||||||
/// },
|
/// },
|
||||||
/// "Click me"
|
/// "Click me"
|
||||||
/// }
|
/// }
|
||||||
|
|||||||
Reference in new issue
Block a user