Skip to content

Commit afbaa52

Browse files
committed
rename orchestrates to calls
1 parent 8fc9d52 commit afbaa52

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/content/reference/react/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The React reference documentation is broken down into functional subsections:
1515
React has idioms — or rules — for how to express patterns in a way that is easy to understand and yields high-quality applications:
1616

1717
* [Components and Hooks must be pure](/reference/rules/components-and-hooks-must-be-pure) – Purity makes your code easier to understand, debug, and allows React to automatically optimize your components and hooks correctly.
18-
* [React orchestrates Components and Hooks](/reference/rules/react-orchestrates-components-and-hooks) – React is responsible for rendering components and hooks when necessary to optimize the user experience.
18+
* [React calls Components and Hooks](/reference/rules/react-calls-components-and-hooks) – React is responsible for rendering components and hooks when necessary to optimize the user experience.
1919
* [Rules of Hooks](/reference/rules/rules-of-hooks) – Hooks are defined using JavaScript functions, but they represent a special type of reusable UI logic with restrictions on where they can be called.
2020

2121
## React {/*react*/}

src/content/reference/rules/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ The Rules of React are proven rules used at companies like Meta that help you ma
4242

4343
---
4444

45-
## React orchestrates Components and Hooks {/*react-orchestrates-components-and-hooks*/}
45+
## React calls Components and Hooks {/*react-calls-components-and-hooks*/}
4646

47-
[React is responsible for rendering components and hooks when necessary to optimize the user experience.](/reference/rules/react-orchestrates-components-and-hooks) It is declarative: you tell React what to render in your component’s logic, and React will figure out how best to display it to your user.
47+
[React is responsible for rendering components and hooks when necessary to optimize the user experience.](/reference/rules/react-calls-components-and-hooks) It is declarative: you tell React what to render in your component’s logic, and React will figure out how best to display it to your user.
4848

49-
* [Never call component functions directly](/reference/rules/react-orchestrates-components-and-hooks#never-call-component-functions-directly) – Components should only be used in JSX. Don’t call them as regular functions.
50-
* [Never pass around hooks as regular values](/reference/rules/react-orchestrates-components-and-hooks#never-pass-around-hooks-as-regular-values) – Hooks should only be called inside of components. Never pass it around as a regular value.
49+
* [Never call component functions directly](/reference/rules/react-calls-components-and-hooks#never-call-component-functions-directly) – Components should only be used in JSX. Don’t call them as regular functions.
50+
* [Never pass around hooks as regular values](/reference/rules/react-calls-components-and-hooks#never-pass-around-hooks-as-regular-values) – Hooks should only be called inside of components. Never pass it around as a regular value.
5151

5252
---
5353

src/content/reference/rules/react-orchestrates-components-and-hooks.md renamed to src/content/reference/rules/react-calls-components-and-hooks.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: React orchestrates Components and Hooks
2+
title: React calls Components and Hooks
33
---
44

55
<Intro>
@@ -11,9 +11,9 @@ React is responsible for rendering components and hooks when necessary to optimi
1111
---
1212

1313
## Never call component functions directly {/*never-call-component-functions-directly*/}
14-
Components should only be used in JSX. Don't call them as regular functions.
14+
Components should only be used in JSX. Don't call them as regular functions. React should call it.
1515

16-
React must decide when your component function is called during rendering. In React, you do this using JSX.
16+
React must decide when your component function is called [during rendering](/reference/rules/components-and-hooks-must-be-pure#how-does-react-run-your-code). In React, you do this using JSX.
1717

1818
```js {2}
1919
function BlogPost() {
@@ -27,7 +27,7 @@ function BlogPost() {
2727
}
2828
```
2929

30-
If a component contains hooks, it's easy to violate the Rules of Hooks when components are called directly in a loop or conditionally.
30+
If a component contains hooks, it's easy to violate the [Rules of Hooks](/reference/rules/rules-of-hooks) when components are called directly in a loop or conditionally.
3131

3232
Letting React orchestrate rendering also allows a number of benefits:
3333

@@ -39,7 +39,7 @@ Letting React orchestrate rendering also allows a number of benefits:
3939

4040
## Never pass around hooks as regular values {/*never-pass-around-hooks-as-regular-values*/}
4141

42-
Hooks should only be called inside of components. Never pass it around as a regular value.
42+
Hooks should only be called inside of components or hooks. Never pass it around as a regular value.
4343

4444
Hooks allow you to augment a component with React features. They should always be called as a function, and never passed around as a regular value. This enables _local reasoning_, or the ability for developers to understand everything a component can do by looking at that component in isolation.
4545

src/content/reference/rules/rules-of-hooks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Hooks are defined using JavaScript functions, but they represent a special type
1212

1313
## Only call Hooks at the top level {/*only-call-hooks-at-the-top-level*/}
1414

15-
Don’t call Hooks inside loops, conditions, or nested functions. Instead, always use Hooks at the top level of your React function, before any early returns.
15+
Don’t call Hooks inside loops, conditions, nested functions, or in `try`/`catch`/`finally` blocks. Instead, always use Hooks at the **top level** of your React function, before any early returns.
1616

1717
By following this rule, you ensure that Hooks are called in the same order each time a component renders. That’s what allows React to correctly preserve the state of Hooks between multiple `useState` and `useEffect` calls.
1818

@@ -82,7 +82,7 @@ useState('Poppins') // 🔴 2 (but was 3). Fail to read the surname state
8282
useEffect(updateTitle) // 🔴 3 (but was 4). Fail to replace the effect
8383
```
8484

85-
React wouldn’t know what to return for the second useState Hook call. React expected that the second Hook call in this component corresponds to the persistForm effect, just like during the previous render, but it doesn’t anymore. From that point, every next Hook call after the one we skipped would also shift by one, leading to bugs.
85+
React wouldn’t know what to return for the second `useState` Hook call. React expected that the second Hook call in this component corresponds to the persistForm effect, just like during the previous render, but it doesn’t anymore. From that point, every next Hook call after the one we skipped would also shift by one, leading to bugs.
8686

8787
This is why Hooks must be called on the top level of our components. If we want to run an effect conditionally, we can put that condition inside our Hook:
8888

src/sidebarReference.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"path": "/reference/rules/components-and-hooks-must-be-pure"
1212
},
1313
{
14-
"title": "React orchestrates Components and Hooks",
15-
"path": "/reference/rules/react-orchestrates-components-and-hooks"
14+
"title": "React calls Components and Hooks",
15+
"path": "/reference/rules/react-calls-components-and-hooks"
1616
},
1717
{
1818
"title": "Rules of Hooks",

0 commit comments

Comments
 (0)