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: src/content/learn/preserving-and-resetting-state.md
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -676,11 +676,7 @@ label {
676
676
677
677
</Sandpack>
678
678
679
-
<<<<<<< HEAD
680
-
当你勾选复选框后计数器的 state 被重置了。虽然你渲染了一个 `Counter`,但是 `div` 的第一个子组件从 `div` 变成了 `section`。当子组件 `div` 从 DOM 中被移除的时候,它底下的整棵树(包含 `Counter` 以及它的 state)也都被销毁了。
681
-
=======
682
-
The counter state gets reset when you click the checkbox. Although you render a `Counter`, the first child of the `div` changes from a `section` to a `div`. When the child `section` was removed from the DOM, the whole tree below it (including the `Counter` and its state) was destroyed as well.
683
-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
679
+
当你勾选复选框后计数器的 state 被重置了。虽然你渲染了一个 `Counter`,但是 `div` 的第一个子组件从 `section` 变成了 `div`。当子组件 `section` 从 DOM 中被移除的时候,它底下的整棵树(包含 `Counter` 以及它的 state)也都被销毁了。
In this example, all button click handlers are ["debounced".](https://kettanaito.com/blog/debounce-vs-throttle) To see what this means, press one of the buttons. Notice how the message appears a second later. If you press the button while waiting for the message, the timer will reset. So if you keep clicking the same button fast many times, the message won't appear until a second *after* you stop clicking. Debouncing lets you delay some action until the user "stops doing things".
Follow the [WAI-ARIA Modal Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal) when creating modals. If you use a community package, ensure that it is accessible and follows these guidelines.
The `prerender` response waits for the entire app to finish rendering, including waiting for all Suspense boundaries to resolve, before resolving. It is designed for static site generation (SSG) ahead of time and does not support streaming more content as it loads.
328
-
329
-
To stream content as it loads, use a streaming server render API like [renderToReadableStream](/reference/react-dom/server/renderToReadableStream).
*[`createContext`](/reference/react/createContext) lets you define and provide context to the child components. Used with [`useContext`.](/reference/react/useContext)
25
-
*[`lazy`](/reference/react/lazy) lets you defer loading a component's code until it's rendered for the first time.
26
-
*[`memo`](/reference/react/memo) lets your component skip re-renders with same props. Used with [`useMemo`](/reference/react/useMemo) and [`useCallback`.](/reference/react/useCallback)
27
-
*[`startTransition`](/reference/react/startTransition) lets you mark a state update as non-urgent. Similar to [`useTransition`.](/reference/react/useTransition)
28
-
*[`act`](/reference/react/act) lets you wrap renders and interactions in tests to ensure updates have processed before making assertions.
**The context object itself does not hold any information.** It represents _which_ context other components read or provide. Typically, you will use [`SomeContext`](#provider) in components above to specify the context value, and call [`useContext(SomeContext)`](/reference/react/useContext) in components below to read it. The context object has a few properties:
48
-
49
-
*`SomeContext` lets you provide the context value to components.
50
-
*`SomeContext.Consumer` is an alternative and rarely used way to read the context value.
51
-
*`SomeContext.Provider` is a legacy way to provide the context value before React 19.
*[`createFactory`](https://18.react.dev/reference/react/createFactory): use JSX instead.
39
-
* Class Components: [`static contextTypes`](https://18.react.dev//reference/react/Component#static-contexttypes): use [`static contextType`](#static-contexttype) instead.
40
-
* Class Components: [`static childContextTypes`](https://18.react.dev//reference/react/Component#static-childcontexttypes): use [`static contextType`](#static-contexttype) instead.
41
-
* Class Components: [`static getChildContext`](https://18.react.dev//reference/react/Component#getchildcontext): use [`Context`](/reference/react/createContext#provider) instead.
42
-
* Class Components: [`static propTypes`](https://18.react.dev//reference/react/Component#static-proptypes): use a type system like [TypeScript](https://www.typescriptlang.org/) instead.
43
-
* Class Components: [`this.refs`](https://18.react.dev//reference/react/Component#refs): use [`createRef`](/reference/react/createRef) instead.
0 commit comments