Skip to content

Commit

Permalink
Improve the second example in the read write same scope warning (#3374)
Browse files Browse the repository at this point in the history
  • Loading branch information
ealmloff authored Dec 17, 2024
1 parent c0e01f9 commit df71924
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/signals/src/warnings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn app() -> Element {
let mut count2 = use_signal(|| 0);
use_effect(move || {
count1.write(count2());
count1.set(count2());
});
}
2) Reading and Writing to the same signal in different scopes:
Expand All @@ -134,7 +134,7 @@ fn app() -> Element {
use_effect(move || {
// This effect both reads and writes to count
println!("{}", count());
count.write(count());
count.set(1);
});
}
Expand All @@ -145,7 +145,7 @@ fn app() -> Element {
let mut count = use_signal(|| 0);
use_effect(move || {
count.write(count());
count.set(1);
});
use_effect(move || {
println!("{}", count());
Expand Down

0 comments on commit df71924

Please sign in to comment.