From bfb1cca902e494e631c2779d541699e58ab7ac60 Mon Sep 17 00:00:00 2001 From: smdmori Date: Wed, 23 Aug 2023 18:49:22 +0330 Subject: [PATCH 1/4] delete unused useState import --- src/content/learn/state-a-components-memory.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/content/learn/state-a-components-memory.md b/src/content/learn/state-a-components-memory.md index 1dbaab4a99e..cdba8e54acb 100644 --- a/src/content/learn/state-a-components-memory.md +++ b/src/content/learn/state-a-components-memory.md @@ -1488,8 +1488,6 @@ Here is a fixed version that uses a regular `name` variable declared in the func ```js -import { useState } from 'react'; - export default function FeedbackForm() { function handleClick() { const name = prompt('What is your name?'); From 204c6bf086afee326d65118c6e0ba0101fcb1c29 Mon Sep 17 00:00:00 2001 From: smdmori Date: Wed, 23 Aug 2023 19:16:04 +0330 Subject: [PATCH 2/4] add word to equalize challenge and solutions texts --- src/content/learn/passing-props-to-a-component.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/learn/passing-props-to-a-component.md b/src/content/learn/passing-props-to-a-component.md index da5fc5efca1..8e756c2f3f3 100644 --- a/src/content/learn/passing-props-to-a-component.md +++ b/src/content/learn/passing-props-to-a-component.md @@ -462,7 +462,7 @@ export default function Gallery() {
  • Discovered: - polonium (element) + polonium (chemical element)
  • From b29dde121c57e5e7dfcd81e445ce42ff2db645ec Mon Sep 17 00:00:00 2001 From: smdmori Date: Sun, 3 Sep 2023 11:41:18 +0330 Subject: [PATCH 3/4] Refactor some texts --- src/content/learn/removing-effect-dependencies.md | 4 ++-- src/content/learn/state-as-a-snapshot.md | 2 +- src/content/learn/synchronizing-with-effects.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content/learn/removing-effect-dependencies.md b/src/content/learn/removing-effect-dependencies.md index 0a5151daaa2..9195cccc0db 100644 --- a/src/content/learn/removing-effect-dependencies.md +++ b/src/content/learn/removing-effect-dependencies.md @@ -926,7 +926,7 @@ function ChatRoom() { useEffect(() => { const options = createOptions(); - const connection = createConnection(); + const connection = createConnection(options); connection.connect(); return () => connection.disconnect(); }, []); // ✅ All dependencies declared @@ -1613,7 +1613,7 @@ label, button { display: block; margin-bottom: 5px; } Your Effect is re-running because it depends on the `options` object. Objects can be re-created unintentionally, you should try to avoid them as dependencies of your Effects whenever possible. -The least invasive fix is to read `roomId` and `serverUrl` right outside the Effect, and then make the Effect depend on those primitive values (which can't change unintentionally). Inside the Effect, create an object and it pass to `createConnection`: +The least invasive fix is to read `roomId` and `serverUrl` right outside the Effect, and then make the Effect depend on those primitive values (which can't change unintentionally). Inside the Effect, create an object and pass it to `createConnection`: diff --git a/src/content/learn/state-as-a-snapshot.md b/src/content/learn/state-as-a-snapshot.md index 503b0abb4c8..fe89609ce11 100644 --- a/src/content/learn/state-as-a-snapshot.md +++ b/src/content/learn/state-as-a-snapshot.md @@ -79,7 +79,7 @@ When React re-renders a component: 1. React calls your function again. 2. Your function returns a new JSX snapshot. -3. React then updates the screen to match the snapshot you've returned. +3. React then updates the screen to match the snapshot your function have returned. diff --git a/src/content/learn/synchronizing-with-effects.md b/src/content/learn/synchronizing-with-effects.md index 24b9f9eb1c6..c708ff7e5c5 100644 --- a/src/content/learn/synchronizing-with-effects.md +++ b/src/content/learn/synchronizing-with-effects.md @@ -767,7 +767,7 @@ Buying is not caused by rendering; it's caused by a specific interaction. It sho } ``` -**This illustrates that if remounting breaks the logic of your application, this usually uncovers existing bugs.** From the user's perspective, visiting a page shouldn't be different from visiting it, clicking a link, and pressing Back. React verifies that your components abide by this principle by remounting them once in development. +**This illustrates that if remounting breaks the logic of your application, this usually uncovers existing bugs.** From the user's perspective, visiting a page shouldn't be different from re-visiting it (clicking a link on the page, and pressing Back). React verifies that your components abide by this principle by remounting them once in development. ## Putting it all together {/*putting-it-all-together*/} From d82a61abd554ec9fc6dfc53ab76eb77b81c09dcc Mon Sep 17 00:00:00 2001 From: Sophie Alpert Date: Fri, 22 Sep 2023 21:33:14 -0700 Subject: [PATCH 4/4] Apply suggestions from code review --- src/content/learn/state-as-a-snapshot.md | 2 +- src/content/learn/synchronizing-with-effects.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/learn/state-as-a-snapshot.md b/src/content/learn/state-as-a-snapshot.md index fe89609ce11..df4eddbd677 100644 --- a/src/content/learn/state-as-a-snapshot.md +++ b/src/content/learn/state-as-a-snapshot.md @@ -79,7 +79,7 @@ When React re-renders a component: 1. React calls your function again. 2. Your function returns a new JSX snapshot. -3. React then updates the screen to match the snapshot your function have returned. +3. React then updates the screen to match the snapshot your function returned. diff --git a/src/content/learn/synchronizing-with-effects.md b/src/content/learn/synchronizing-with-effects.md index c708ff7e5c5..7319fdb4f9f 100644 --- a/src/content/learn/synchronizing-with-effects.md +++ b/src/content/learn/synchronizing-with-effects.md @@ -767,7 +767,7 @@ Buying is not caused by rendering; it's caused by a specific interaction. It sho } ``` -**This illustrates that if remounting breaks the logic of your application, this usually uncovers existing bugs.** From the user's perspective, visiting a page shouldn't be different from re-visiting it (clicking a link on the page, and pressing Back). React verifies that your components abide by this principle by remounting them once in development. +**This illustrates that if remounting breaks the logic of your application, this usually uncovers existing bugs.** From a user's perspective, visiting a page shouldn't be different from visiting it, clicking a link, then pressing Back to view the page again. React verifies that your components abide by this principle by remounting them once in development. ## Putting it all together {/*putting-it-all-together*/}