Skip to content

Commit

Permalink
fix peek() example (#3375)
Browse files Browse the repository at this point in the history
Co-authored-by: Anatol Ulrich <[email protected]>
  • Loading branch information
spookyvision and Anatol Ulrich authored Dec 17, 2024
1 parent 040dc54 commit 0596e53
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/signals/src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ pub trait Readable {
/// 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 can read the value with peek without subscribing to updates
/// let click_count = count.peek();
/// tracing::info!("Click count: {click_count:?}");
/// let source = event_source.peek();
/// tracing::info!("Clicked: {source:?}");
/// count() * 2
/// });
/// rsx! {
Expand All @@ -149,6 +149,7 @@ pub trait Readable {
/// button {
/// onclick: move |_| {
/// event_source.set(Some("Click me button"));
/// count += 1;
/// },
/// "Click me"
/// }
Expand Down

0 comments on commit 0596e53

Please sign in to comment.