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: public/rss.xml
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@
4
4
<description><![CDATA[This blog is the official source for the updates from the React team. Anything important, including release notes or deprecation notices, will be posted here first.]]></description>
5
5
<link>https://react.dev/</link>
6
6
<generator>react.dev rss module</generator>
7
-
<lastBuildDate>Tue, 20 Aug 2024 08:06:26 GMT</lastBuildDate>
7
+
<lastBuildDate>Tue, 15 Oct 2024 19:03:53 GMT</lastBuildDate>
Copy file name to clipboardExpand all lines: src/content/learn/react-compiler.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,6 @@ These docs are still a work in progress. More documentation is available in the
20
20
21
21
<Note>
22
22
React Compiler is a new experimental compiler that we've open sourced to get early feedback from the community. It still has rough edges and is not yet fully ready for production.
23
-
24
-
React Compiler requires React 19 RC. If you are unable to upgrade to React 19, you may try a userspace implementation of the cache function as described in the [Working Group](https://github.com/reactwg/react-compiler/discussions/6). However, please note that this is not recommended and you should upgrade to React 19 when possible.
25
23
</Note>
26
24
27
25
React Compiler is a new experimental compiler that we've open sourced to get early feedback from the community. It is a build-time only tool that automatically optimizes your React app. It works with plain JavaScript, and understands the [Rules of React](/reference/rules), so you don't need to rewrite any code to use it.
@@ -226,6 +224,29 @@ module.exports = function () {
226
224
227
225
`babel-plugin-react-compiler` should run first before other Babel plugins as the compiler requires the input source information for sound analysis.
228
226
227
+
React Compiler works best with React 19 RC. If you are unable to upgrade, you can install the extra `react-compiler-runtime` package which will allow the compiled code to run on versions prior to 19. However, note that the minimum supported version is 17.
228
+
229
+
<TerminalBlock>
230
+
npm install react-compiler-runtime@experimental
231
+
</TerminalBlock>
232
+
233
+
You should also add the correct `target` to your compiler config, where `target` is the major version of React you are targeting:
*`ProductTable` күйлерге негізделген өнімдер тізімін фильтрлеу (іздеу сұрауы және чекбокс ұяшығының мәні).
274
-
*`SearchBar` сол күйді көрсету керек (іздеу мәтіні және чекбокс мәні).
275
-
1.**Олардың ортақ негізгі компонентін табыңыз:** Екі компоненттің ортақ негізгі компоненті `FilterableProductTable` болып табылады.
276
-
2.**Күй қайда тұратынын шешіңіз**: Фильтр мәтінін және чекбокс күй мәндерін `FilterableProductTable` ішінде сақтаймыз.
277
-
278
-
Осылайша күй мәндері `FilterableProductTable` ішінде орналасады.
279
-
=======
280
271
1.**Identify components that use state:**
281
272
*`ProductTable` needs to filter the product list based on that state (search text and checkbox value).
282
273
*`SearchBar` needs to display that state (search text and checkbox value).
283
274
2.**Find their common parent:** The first parent component both components share is `FilterableProductTable`.
284
275
3.**Decide where the state lives**: We'll keep the filter text and checked state values in `FilterableProductTable`.
285
-
>>>>>>> 1697ae89a3bbafd76998dd7496754e5358bc1e9a
286
276
287
277
Компонент күйді [`useState()` Hook](/reference/react/useState) арқылы қосамыз. Хуктар - бұл React-ке қосылуға мүмкіндік беретін арнайы "ілмек" функциялар. `FilterableProductTable` жоғарғы жағына екі күй айнымалы мәнін қосыңыз және олардың бастапқы күйін көрсетіңіз:
{/* TODO T164397693: link to actions documentation once it exists */}
37
37
38
-
Call `useActionState` at the top level of your component to create component state that is updated [when a form action is invoked](/reference/react-dom/components/form). You pass `useActionState` an existing form action function as well as an initial state, and it returns a new action that you use in your form, along with the latest form state. The latest form state is also passed to the function that you provided.
38
+
Call `useActionState` at the top level of your component to create component state that is updated [when a form action is invoked](/reference/react-dom/components/form). You pass `useActionState` an existing form action function as well as an initial state, and it returns a new action that you use in your form, along with the latest form state and whether the Action is still pending. The latest form state is also passed to the function that you provided.
39
39
40
40
```js
41
41
import { useActionState } from"react";
@@ -71,10 +71,11 @@ If used with a Server Action, `useActionState` allows the server's response from
71
71
72
72
#### Returns {/*returns*/}
73
73
74
-
`useActionState` returns an array with exactly two values:
74
+
`useActionState` returns an array with the following values:
75
75
76
76
1. The current state. During the first render, it will match the `initialState` you have passed. After the action is invoked, it will match the value returned by the action.
77
77
2. A new action that you can pass as the `action` prop to your `form` component or `formAction` prop to any `button` component within the form.
78
+
3. The `isPending` flag that tells you whether there is a pending Transition.
78
79
79
80
#### Caveats {/*caveats*/}
80
81
@@ -104,10 +105,11 @@ function MyComponent() {
104
105
}
105
106
```
106
107
107
-
`useActionState` returns an array with exactly two items:
108
+
`useActionState` returns an array with the following items:
108
109
109
110
1. The <CodeStep step={1}>current state</CodeStep> of the form, which is initially set to the <CodeStep step={4}>initial state</CodeStep> you provided, and after the form is submitted is set to the return value of the <CodeStep step={3}>action</CodeStep> you provided.
110
111
2. A <CodeStep step={2}>new action</CodeStep> that you pass to `<form>` as its `action` prop.
112
+
3. A <CodeStep step={1}>pending state</CodeStep> that you can utilise whilst your action is processing.
111
113
112
114
When the form is submitted, the <CodeStep step={3}>action</CodeStep> function that you provided will be called. Its return value will become the new <CodeStep step={1}>current state</CodeStep> of the form.
0 commit comments