From 085b5f2d736e2d1d3cd82507a7c64550e4e5b645 Mon Sep 17 00:00:00 2001 From: Sekhar Das Date: Fri, 21 Nov 2025 21:50:10 +0530 Subject: [PATCH 1/5] fix: remove outdated expectedErrors metadata Fix formatting of code block in the documentation. --- src/content/learn/you-might-not-need-an-effect.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/learn/you-might-not-need-an-effect.md b/src/content/learn/you-might-not-need-an-effect.md index 81a0842eb60..400f48c628f 100644 --- a/src/content/learn/you-might-not-need-an-effect.md +++ b/src/content/learn/you-might-not-need-an-effect.md @@ -34,7 +34,8 @@ To help you gain the right intuition, let's look at some common concrete example Suppose you have a component with two state variables: `firstName` and `lastName`. You want to calculate a `fullName` from them by concatenating them. Moreover, you'd like `fullName` to update whenever `firstName` or `lastName` change. Your first instinct might be to add a `fullName` state variable and update it in an Effect: -```js {expectedErrors: {'react-compiler': [8]}} {5-9} +```js {5-9} + function Form() { const [firstName, setFirstName] = useState('Taylor'); const [lastName, setLastName] = useState('Swift'); From 9b68be911a050108c71007167d852d647842593e Mon Sep 17 00:00:00 2001 From: Sekhar Das Date: Fri, 21 Nov 2025 22:06:03 +0530 Subject: [PATCH 2/5] Clean up example code in you-might-not-need-an-effect.md Removed unnecessary lines from the example code. --- src/content/learn/you-might-not-need-an-effect.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/learn/you-might-not-need-an-effect.md b/src/content/learn/you-might-not-need-an-effect.md index 400f48c628f..0d2ff507a40 100644 --- a/src/content/learn/you-might-not-need-an-effect.md +++ b/src/content/learn/you-might-not-need-an-effect.md @@ -35,7 +35,6 @@ To help you gain the right intuition, let's look at some common concrete example Suppose you have a component with two state variables: `firstName` and `lastName`. You want to calculate a `fullName` from them by concatenating them. Moreover, you'd like `fullName` to update whenever `firstName` or `lastName` change. Your first instinct might be to add a `fullName` state variable and update it in an Effect: ```js {5-9} - function Form() { const [firstName, setFirstName] = useState('Taylor'); const [lastName, setLastName] = useState('Swift'); From 7e8db7ec3f3754b382265e6bc582e84c5abb9cbb Mon Sep 17 00:00:00 2001 From: Sekhar Das Date: Fri, 21 Nov 2025 22:27:29 +0530 Subject: [PATCH 3/5] Update example for calculating fullName from state Clarify the example of updating state based on props or state in the documentation. --- src/content/learn/you-might-not-need-an-effect.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/learn/you-might-not-need-an-effect.md b/src/content/learn/you-might-not-need-an-effect.md index 0d2ff507a40..cf5aef6b837 100644 --- a/src/content/learn/you-might-not-need-an-effect.md +++ b/src/content/learn/you-might-not-need-an-effect.md @@ -34,6 +34,7 @@ To help you gain the right intuition, let's look at some common concrete example Suppose you have a component with two state variables: `firstName` and `lastName`. You want to calculate a `fullName` from them by concatenating them. Moreover, you'd like `fullName` to update whenever `firstName` or `lastName` change. Your first instinct might be to add a `fullName` state variable and update it in an Effect: +```js {expectedErrors: {'react-compiler': [8]}} {5-9} ```js {5-9} function Form() { const [firstName, setFirstName] = useState('Taylor'); From a3ea1ff2a5a94bad4d23cda26a39df8208a804a1 Mon Sep 17 00:00:00 2001 From: Sekhar Das Date: Fri, 21 Nov 2025 22:34:11 +0530 Subject: [PATCH 4/5] Update documentation on state variable usage Clarified example of updating state based on props or state in the documentation. --- src/content/learn/you-might-not-need-an-effect.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/learn/you-might-not-need-an-effect.md b/src/content/learn/you-might-not-need-an-effect.md index cf5aef6b837..0d2ff507a40 100644 --- a/src/content/learn/you-might-not-need-an-effect.md +++ b/src/content/learn/you-might-not-need-an-effect.md @@ -34,7 +34,6 @@ To help you gain the right intuition, let's look at some common concrete example Suppose you have a component with two state variables: `firstName` and `lastName`. You want to calculate a `fullName` from them by concatenating them. Moreover, you'd like `fullName` to update whenever `firstName` or `lastName` change. Your first instinct might be to add a `fullName` state variable and update it in an Effect: -```js {expectedErrors: {'react-compiler': [8]}} {5-9} ```js {5-9} function Form() { const [firstName, setFirstName] = useState('Taylor'); From 67e31d6322e24eb0564b62b92bb6d70b555a01e1 Mon Sep 17 00:00:00 2001 From: Sekhar Das Date: Fri, 21 Nov 2025 22:34:50 +0530 Subject: [PATCH 5/5] Update you-might-not-need-an-effect.md