Skip to content

Commit 402f311

Browse files
committed
Capitalize 'Actions' as React concept
Based on issue #6713 - capitalize React-specific concepts in docs - 'dispatching actions' -> 'dispatching Actions' - 'user actions' -> 'user Actions' Excludes blog/community pages per issue guidelines.
1 parent ba6dc00 commit 402f311

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/content/learn/extracting-state-logic-into-a-reducer.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ Each of its event handlers calls `setTasks` in order to update the state. As thi
183183

184184
Reducers are a different way to handle state. You can migrate from `useState` to `useReducer` in three steps:
185185

186-
1. **Move** from setting state to dispatching actions.
186+
1. **Move** from setting state to dispatching Actions.
187187
2. **Write** a reducer function.
188188
3. **Use** the reducer from your component.
189189

190-
### Step 1: Move from setting state to dispatching actions {/*step-1-move-from-setting-state-to-dispatching-actions*/}
190+
### Step 1: Move from setting state to dispatching Actions {/*step-1-move-from-setting-state-to-dispatching-actions*/}
191191

192192
Your event handlers currently specify _what to do_ by setting state:
193193

@@ -226,7 +226,7 @@ Remove all the state setting logic. What you are left with are three event handl
226226
- `handleChangeTask(task)` is called when the user toggles a task or presses "Save".
227227
- `handleDeleteTask(taskId)` is called when the user presses "Delete".
228228

229-
Managing state with reducers is slightly different from directly setting state. Instead of telling React "what to do" by setting state, you specify "what the user just did" by dispatching "actions" from your event handlers. (The state update logic will live elsewhere!) So instead of "setting `tasks`" via an event handler, you're dispatching an "added/changed/deleted a task" action. This is more descriptive of the user's intent.
229+
Managing state with reducers is slightly different from directly setting state. Instead of telling React "what to do" by setting state, you specify "what the user just did" by dispatching "Actions" from your event handlers. (The state update logic will live elsewhere!) So instead of "setting `tasks`" via an event handler, you're dispatching an "added/changed/deleted a task" action. This is more descriptive of the user's intent.
230230

231231
```js
232232
function handleAddTask(text) {
@@ -862,7 +862,7 @@ li {
862862

863863
</Sandpack>
864864

865-
Component logic can be easier to read when you separate concerns like this. Now the event handlers only specify _what happened_ by dispatching actions, and the reducer function determines _how the state updates_ in response to them.
865+
Component logic can be easier to read when you separate concerns like this. Now the event handlers only specify _what happened_ by dispatching Actions, and the reducer function determines _how the state updates_ in response to them.
866866

867867
## Comparing `useState` and `useReducer` {/*comparing-usestate-and-usereducer*/}
868868

src/content/learn/managing-state.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ Read **[Preserving and Resetting State](/learn/preserving-and-resetting-state)**
502502

503503
## Extracting state logic into a reducer {/*extracting-state-logic-into-a-reducer*/}
504504

505-
Components with many state updates spread across many event handlers can get overwhelming. For these cases, you can consolidate all the state update logic outside your component in a single function, called "reducer". Your event handlers become concise because they only specify the user "actions". At the bottom of the file, the reducer function specifies how the state should update in response to each action!
505+
Components with many state updates spread across many event handlers can get overwhelming. For these cases, you can consolidate all the state update logic outside your component in a single function, called "reducer". Your event handlers become concise because they only specify the user "Actions". At the bottom of the file, the reducer function specifies how the state should update in response to each action!
506506

507507
<Sandpack>
508508

0 commit comments

Comments
 (0)