You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorials/fundamentals/part-2-concepts-data-flow.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ This is a small example of **"one-way data flow"**:
70
70
71
71

72
72
73
-
However, the simplicity can break down when we have **multiple components that need to share and use the same state**, especially if those components are located in different parts of the application. Sometimes this can be solved by ["lifting state up"](https://reactjs.org/docs/lifting-state-up.html) to parent components, but that doesn't always help.
73
+
However, the simplicity can break down when we have **multiple components that need to share and use the same state**, especially if those components are located in different parts of the application. Sometimes this can be solved by ["lifting state up"](https://react.dev/learn/sharing-state-between-components) to parent components, but that doesn't always help.
74
74
75
75
One way to solve this is to extract the shared state from the components, and put it into a centralized location outside the component tree. With this, our component tree becomes a big "view", and any component can access the state or trigger actions, no matter where they are in the tree!
Copy file name to clipboardExpand all lines: docs/tutorials/fundamentals/part-3-state-actions-reducers.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,7 +158,7 @@ think about these different kinds of categories to help understand how the diffe
158
158
### Designing the State Structure
159
159
160
160
With Redux, **our application state is always kept in plain JavaScript objects and arrays**. That means you may not put
161
-
other things into the Redux state - no class instances, built-in JS types like `Map` / `Set``Promise` / `Date`, functions, or anything else that is not plain JS data.
161
+
other things into the Redux state - no class instances, built-in JS types like `Map` / `Set`/ `Promise` / `Date`, functions, or anything else that is not plain JS data.
162
162
163
163
**The root Redux state value is almost always a plain JS object**, with other data nested inside of it.
Copy file name to clipboardExpand all lines: docs/tutorials/fundamentals/part-5-ui-and-react.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,7 +139,7 @@ Here's the initial React UI of this app before we start adding any Redux-related
139
139
140
140
We know that we need to be able to show a list of todo items. Let's start by creating a `<TodoList>` component that can read the list of todos from the store, loop over them, and show one `<TodoListItem>` component for each todo entry.
141
141
142
-
You should be familiar with [React hooks like `useState`](https://reactjs.org/docs/hooks-state.html), which can be called in React function components to give them access to React state values. React also lets us write [custom hooks](https://reactjs.org/docs/hooks-custom.html), which let us extract reusable hooks to add our own behavior on top of React's built-in hooks.
142
+
You should be familiar with [React hooks like `useState`](https://react.dev/reference/react/useState), which can be called in React function components to give them access to React state values. React also lets us write [custom hooks](https://react.dev/learn/reusing-logic-with-custom-hooks), which let us extract reusable hooks to add our own behavior on top of React's built-in hooks.
143
143
144
144
Like many other libraries, React-Redux includes [its own custom hooks](https://react-redux.js.org/api/hooks), which you can use in your own components. The React-Redux hooks give your React component the ability to talk to the Redux store by reading state and dispatching actions.
145
145
@@ -238,7 +238,7 @@ So, we can call `const dispatch = useDispatch()` in any component that needs to
238
238
239
239
Let's try that in our `<Header>` component. We know that we need to let the user type in some text for a new todo item, and then dispatch a `{type: 'todos/todoAdded'}` action containing that text.
240
240
241
-
We'll write a typical React form component that uses ["controlled inputs"](https://reactjs.org/docs/forms.html#controlled-components) to let the user type in the form text. Then, when the user presses the Enter key specifically, we'll dispatch that action.
241
+
We'll write a typical React form component that uses ["controlled inputs"](https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable) to let the user type in the form text. Then, when the user presses the Enter key specifically, we'll dispatch that action.
242
242
243
243
```jsx title="src/features/header/Header.js"
244
244
importReact, { useState } from'react'
@@ -433,7 +433,7 @@ This works, but there's a potential performance problem.
433
433
434
434
Re-rendering components isn't bad - that's how React knows if it needs to update the DOM. But, re-rendering lots of components when nothing has actually changed can potentially get too slow if the list is too big.
435
435
436
-
There's a couple ways we could try to fix this. One option is to [wrap all the `<TodoListItem>` components in `React.memo()`](https://reactjs.org/docs/react-api.html#reactmemo), so that they only re-render when their props actually change. This is often a good choice for improving performance, but it does require that the child component always receives the same props until something really changes. Since each `<TodoListItem>` component is receiving a todo item as a prop, only one of them should actually get a changed prop and have to re-render.
436
+
There's a couple ways we could try to fix this. One option is to [wrap all the `<TodoListItem>` components in `React.memo()`](https://react.dev/reference/react/memo), so that they only re-render when their props actually change. This is often a good choice for improving performance, but it does require that the child component always receives the same props until something really changes. Since each `<TodoListItem>` component is receiving a todo item as a prop, only one of them should actually get a changed prop and have to re-render.
437
437
438
438
Another option is to have the `<TodoList>` component only read an array of todo IDs from the store, and pass those IDs as props to the child `<TodoListItem>` components. Then, each `<TodoListItem>` can use that ID to find the right todo object it needs.
0 commit comments