Skip to content

Commit 1758515

Browse files
smdmorisophiebits
andauthored
Fix text in docs (#6253)
* delete unused useState import * add word to equalize challenge and solutions texts * Refactor some texts * Apply suggestions from code review --------- Co-authored-by: Sophie Alpert <git@sophiebits.com>
1 parent a1fbcf8 commit 1758515

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

src/content/learn/passing-props-to-a-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export default function Gallery() {
462462
</li>
463463
<li>
464464
<b>Discovered: </b>
465-
polonium (element)
465+
polonium (chemical element)
466466
</li>
467467
</ul>
468468
</section>

src/content/learn/removing-effect-dependencies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ function ChatRoom() {
926926

927927
useEffect(() => {
928928
const options = createOptions();
929-
const connection = createConnection();
929+
const connection = createConnection(options);
930930
connection.connect();
931931
return () => connection.disconnect();
932932
}, []); // ✅ All dependencies declared
@@ -1613,7 +1613,7 @@ label, button { display: block; margin-bottom: 5px; }
16131613
16141614
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.
16151615
1616-
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`:
1616+
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`:
16171617
16181618
<Sandpack>
16191619

src/content/learn/state-a-components-memory.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,8 +1488,6 @@ Here is a fixed version that uses a regular `name` variable declared in the func
14881488
<Sandpack>
14891489

14901490
```js
1491-
import { useState } from 'react';
1492-
14931491
export default function FeedbackForm() {
14941492
function handleClick() {
14951493
const name = prompt('What is your name?');

src/content/learn/state-as-a-snapshot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ When React re-renders a component:
7979

8080
1. React calls your function again.
8181
2. Your function returns a new JSX snapshot.
82-
3. React then updates the screen to match the snapshot you've returned.
82+
3. React then updates the screen to match the snapshot your function returned.
8383

8484
<IllustrationBlock sequential>
8585
<Illustration caption="React executing the function" src="/images/docs/illustrations/i_render1.png" />

src/content/learn/synchronizing-with-effects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ Buying is not caused by rendering; it's caused by a specific interaction. It sho
767767
}
768768
```
769769
770-
**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.
770+
**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.
771771
772772
## Putting it all together {/*putting-it-all-together*/}
773773

0 commit comments

Comments
 (0)