Skip to content

Commit df71924

Browse files
authored
Improve the second example in the read write same scope warning (#3374)
1 parent c0e01f9 commit df71924

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/signals/src/warnings.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn app() -> Element {
121121
let mut count2 = use_signal(|| 0);
122122
123123
use_effect(move || {
124-
count1.write(count2());
124+
count1.set(count2());
125125
});
126126
}
127127
2) Reading and Writing to the same signal in different scopes:
@@ -134,7 +134,7 @@ fn app() -> Element {
134134
use_effect(move || {
135135
// This effect both reads and writes to count
136136
println!("{}", count());
137-
count.write(count());
137+
count.set(1);
138138
});
139139
}
140140
@@ -145,7 +145,7 @@ fn app() -> Element {
145145
let mut count = use_signal(|| 0);
146146
147147
use_effect(move || {
148-
count.write(count());
148+
count.set(1);
149149
});
150150
use_effect(move || {
151151
println!("{}", count());

0 commit comments

Comments
 (0)