From 26e9e14d8589e68eb5f29ca85252e7b8f3b8abd3 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Thu, 16 Feb 2023 09:04:45 -0800 Subject: [PATCH] Fix typo --- .../hir/inadvertent-mutability-readonly-lambda.expect.md | 6 +++--- .../fixtures/hir/inadvertent-mutability-readonly-lambda.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.expect.md b/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.expect.md index 61e283f619..b84ed09282 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.expect.md @@ -6,7 +6,7 @@ function Component(props) { const [value, setValue] = useState(null); // NOTE: this lambda does not capture any mutable values (only the state setter) // and thus should be treated as readonly - const onChange = (e) => setX((value) => value + e.target.value); + const onChange = (e) => setValue((value) => value + e.target.value); useOtherHook(); @@ -22,9 +22,9 @@ function Component(props) { ```javascript function Component(props) { - useState(null); + const setValue = useState(null)[1]; - const onChange = (e) => setX((value) => value + e.target.value); + const onChange = (e) => setValue((value) => value + e.target.value); useOtherHook(); diff --git a/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.js b/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.js index 0bdca05afd..bd10465c74 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.js +++ b/compiler/forget/src/__tests__/fixtures/hir/inadvertent-mutability-readonly-lambda.js @@ -2,7 +2,7 @@ function Component(props) { const [value, setValue] = useState(null); // NOTE: this lambda does not capture any mutable values (only the state setter) // and thus should be treated as readonly - const onChange = (e) => setX((value) => value + e.target.value); + const onChange = (e) => setValue((value) => value + e.target.value); useOtherHook();