Fix typo
Joe Savona committed
Feb 16, 2023 at 09:04 UTC
26e9e14d8589e68eb5f29ca85252e7b8f3b8abd3
2 files changed
+4
-4
compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.expect.md
+3
-3
@@ -6,7 +6,7 @@ function Component(props) {
6
const [value, setValue] = useState(null);
7
// NOTE: this lambda does not capture any mutable values (only the state setter)
8
// and thus should be treated as readonly
9
- const onChange = (e) => setX((value) => value + e.target.value);
9
+ const onChange = (e) => setValue((value) => value + e.target.value);
10
11
useOtherHook();
12
@@ -22,9 +22,9 @@ function Component(props) {
22
23
```javascript
24
function Component(props) {
25
- useState(null);
25
+ const setValue = useState(null)[1];
26
27
- const onChange = (e) => setX((value) => value + e.target.value);
27
+ const onChange = (e) => setValue((value) => value + e.target.value);
28
29
useOtherHook();
30
compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.js
+1
-1
@@ -2,7 +2,7 @@ function Component(props) {
2
const [value, setValue] = useState(null);
3
// NOTE: this lambda does not capture any mutable values (only the state setter)
4
// and thus should be treated as readonly
5
- const onChange = (e) => setX((value) => value + e.target.value);
5
+ const onChange = (e) => setValue((value) => value + e.target.value);
6
7
useOtherHook();
8