Skip to content

Commit d5eeb5a

Browse files
authored
Merge pull request #610 from reactjs/sync-65d297e9
Sync with react.dev @ 65d297e Add translations for the 500 page Add versions and blog intro translations, add related changes
2 parents de12f13 + 7e6a769 commit d5eeb5a

28 files changed

+438
-264
lines changed

TRANSLATION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,13 @@
180180
| package registry | реєстр пакетів |
181181
| paint | фарбування, перефарбування |
182182
| performance | продуктивність (TODO: розглянути "швидкодію") |
183+
| (blog) post | допис (у блозі) |
183184
| prop | проп |
184185
| props | пропси |
185186
| production | публічне середовище; впровадження |
186187
| production mode | (у режимі) публічного середовища; режим публічного впровадження |
187188
| reducer | редюсер |
189+
| release | реліз |
188190
| reuse | повторне використання, перевикористання |
189191
| React | React |
190192
| React element | React-елемент, елемент React |
75.6 KB
Binary file not shown.
64.9 KB
Binary file not shown.
Binary file not shown.

src/components/Layout/HomeContent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,8 @@ function ExampleLayout({
864864
</div>
865865
<div
866866
ref={contentRef}
867-
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center">
867+
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center"
868+
dir="ltr">
868869
{right}
869870
<div
870871
className={cn(

src/components/MDX/MDXComponents.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,12 @@ function LearnMore({
203203

204204
function ReadBlogPost({path}: {path: string}) {
205205
return (
206-
<ButtonLink className="mt-1" label="Read Post" href={path} type="primary">
207-
Переглянути публікацію
206+
<ButtonLink
207+
className="mt-1"
208+
label="Читати допис"
209+
href={path}
210+
type="primary">
211+
Переглянути допис
208212
<IconNavArrow displayDirection="end" className="inline ms-1" />
209213
</ButtonLink>
210214
);

src/components/MDX/Sandpack/template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const template = {
22
'/src/index.js': {
33
hidden: true,
4-
code: `import React, { StrictMode } from "react";
4+
code: `import { StrictMode } from "react";
55
import { createRoot } from "react-dom/client";
66
import "./styles.css";
77

src/components/PageHeading.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function PageHeading({
2727
tags = [],
2828
breadcrumbs,
2929
}: PageHeadingProps) {
30-
console.log('version', version);
3130
return (
3231
<div className="px-5 sm:px-12 pt-3.5">
3332
<div className="max-w-4xl ms-0 2xl:mx-auto">

src/components/Seo.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ export const Seo = withRouter(
124124
)}
125125
<link
126126
rel="preload"
127-
href="/fonts/Source-Code-Pro-Regular.woff2"
127+
href="https://react.dev/fonts/Source-Code-Pro-Regular.woff2"
128+
as="font"
129+
type="font/woff2"
130+
crossOrigin="anonymous"
131+
/>
132+
<link
133+
rel="preload"
134+
href="https://react.dev/fonts/Source-Code-Pro-Bold.woff2"
128135
as="font"
129136
type="font/woff2"
130137
crossOrigin="anonymous"

src/content/blog/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ title: Блог React
44

55
<Intro>
66

7-
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.
7+
Цей блог є офіційним джерелом оновлень від команди React. Все важливе, включно з нотатками релізу або повідомленнями про застарілі функції, буде опубліковано спершу тут.
88

9-
You can also follow the [@react.dev](https://bsky.app/profile/react.dev) account on Bluesky, or [@reactjs](https://twitter.com/reactjs) account on Twitter, but you won’t miss anything essential if you only read this blog.
9+
Ви також можете слідкувати за [@react.dev](https://bsky.app/profile/react.dev) на платформі Bluesky або за [@reactjs](https://twitter.com/reactjs) у Twitter, але ви не пропустите нічого суттєвого, якщо читатимете лише цей блог.
1010

1111
</Intro>
1212

@@ -112,14 +112,14 @@ The React team is excited to share a few updates:
112112

113113
---
114114

115-
### All release notes {/*all-release-notes*/}
115+
### Усі нотатки до релізів {/*all-release-notes*/}
116116

117-
Not every React release deserves its own blog post, but you can find a detailed changelog for every release in the [`CHANGELOG.md`](https://github.com/facebook/react/blob/main/CHANGELOG.md) file in the React repository, as well as on the [Releases](https://github.com/facebook/react/releases) page.
117+
Не кожен реліз React заслуговує на окремий допис у блозі, проте ви можете знайти детальний список змін для кожного релізу у файлі [`CHANGELOG.md`](https://github.com/facebook/react/blob/main/CHANGELOG.md) у репозиторії React, а також на сторінці ["Релізи"](https://github.com/facebook/react/releases).
118118

119119
---
120120

121-
### Старіші публікації {/*older-posts*/}
121+
### Старіші дописи {/*older-posts*/}
122122

123-
Перегляньте [старіші публікації.](https://reactjs.org/blog/all.html)
123+
Перегляньте [старіші дописи.](https://reactjs.org/blog/all.html)
124124

125125
<div className="h-12"></div>

src/content/community/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ Each community consists of many thousands of React users.
2929

3030
## News {/*news*/}
3131

32-
For the latest news about React, [follow **@reactjs** on Twitter](https://twitter.com/reactjs) and the [official React blog](/blog/) on this website.
32+
For the latest news about React, [follow **@reactjs** on Twitter](https://twitter.com/reactjs), [**@react.dev** on Bluesky](https://bsky.app/profile/react.dev) and the [official React blog](/blog/) on this website.

src/content/community/meetups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
3838

3939
## Canada {/*canada*/}
4040
* [Halifax, NS](https://www.meetup.com/Halifax-ReactJS-Meetup/)
41-
* [Montreal, QC - React Native](https://www.meetup.com/fr-FR/React-Native-MTL/)
41+
* [Montreal, QC](https://guild.host/react-montreal/)
4242
* [Vancouver, BC](https://www.meetup.com/ReactJS-Vancouver-Meetup/)
4343
* [Ottawa, ON](https://www.meetup.com/Ottawa-ReactJS-Meetup/)
4444
* [Saskatoon, SK](https://www.meetup.com/saskatoon-react-meetup/)

src/content/community/versioning-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Versioning Policy
2+
title: Політика версіонування
33
---
44

55
<Intro>

src/content/learn/build-a-react-app-from-scratch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Rsbuild відразу підтримує такі функції React, як ш
116116
Розділення коду за маршрутом, інтегроване з бандлером й отриманням даних, може зменшити час початкового завантаження вашого застосунку та рендерингу найбільшого видимого вмісту застосунку ([малювання найбільшого вмісту, LCP](https://web.dev/articles/lcp)).
117117

118118
Для інструкцій з розділення коду перегляньте документацію вашого інструменту збирання:
119-
- [Оптимізації збирання у Vite](https://v3.vitejs.dev/guide/features.html#build-optimizations)
119+
- [Оптимізації збирання у Vite](https://vite.dev/guide/features.html#build-optimizations)
120120
- [Розділення коду в Parcel](https://parceljs.org/features/code-splitting/)
121121
- [Розділення коду в Rsbuild](https://rsbuild.dev/guide/optimization/code-splitting)
122122

src/content/learn/preserving-and-resetting-state.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,7 +2011,7 @@ export default function ContactList() {
20112011
<label>
20122012
<input
20132013
type="checkbox"
2014-
value={reverse}
2014+
checked={reverse}
20152015
onChange={e => {
20162016
setReverse(e.target.checked)
20172017
}}
@@ -2110,7 +2110,7 @@ export default function ContactList() {
21102110
<label>
21112111
<input
21122112
type="checkbox"
2113-
value={reverse}
2113+
checked={reverse}
21142114
onChange={e => {
21152115
setReverse(e.target.checked)
21162116
}}

src/content/learn/removing-effect-dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ export default function Timer() {
12411241
12421242
</Sandpack>
12431243
1244-
Instead of reading `count` inside the Effect, you pass a `c => c + 1` instruction ("increment this number!") to React. React will apply it on the next render. And since you don't need to read the value of `count` inside your Effect anymore, so you can keep your Effect's dependencies empty (`[]`). This prevents your Effect from re-creating the interval on every tick.
1244+
Instead of reading `count` inside the Effect, you pass a `c => c + 1` instruction ("increment this number!") to React. React will apply it on the next render. And since you don't need to read the value of `count` inside your Effect anymore, you can keep your Effect's dependencies empty (`[]`). This prevents your Effect from re-creating the interval on every tick.
12451245
12461246
</Solution>
12471247

src/content/learn/reusing-logic-with-custom-hooks.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ export default function ChatRoom({ roomId }) {
820820
// ...
821821
```
822822
823-
and pass it as an input to another Hook:
823+
and passing it as an input to another Hook:
824824
825825
```js {6}
826826
export default function ChatRoom({ roomId }) {
@@ -2081,7 +2081,6 @@ Write `useInterval` in the `useInterval.js` file and import it into the `useCoun
20812081
<Sandpack>
20822082
20832083
```js
2084-
import { useState } from 'react';
20852084
import { useCounter } from './useCounter.js';
20862085

20872086
export default function Counter() {

src/content/learn/separating-events-from-effects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ function ChatRoom({ roomId, theme }) {
439439
// ...
440440
```
441441
442-
This solves the problem. Note that you had to *remove* `onConnected` from the list of your Effect's dependencies. **Effect Events are not reactive and must be omitted from dependencies.**
442+
This solves the problem. Note that you had to *remove* `theme` from the list of your Effect's dependencies, because it's no longer used in the Effect. You also don't need to *add* `onConnected` to it, because **Effect Events are not reactive and must be omitted from dependencies.**
443443
444444
Verify that the new behavior works as you would expect:
445445

src/content/reference/react-dom/preinit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The `preinit` function provides the browser with a hint that it should start dow
4848
* `options`: an object. It contains the following properties:
4949
* `as`: a required string. The type of resource. Its possible values are `script` and `style`.
5050
* `precedence`: a string. Required with stylesheets. Says where to insert the stylesheet relative to others. Stylesheets with higher precedence can override those with lower precedence. The possible values are `reset`, `low`, `medium`, `high`.
51-
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`. It is required when `as` is set to `"fetch"`.
51+
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`.
5252
* `integrity`: a string. A cryptographic hash of the resource, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
5353
* `nonce`: a string. A cryptographic [nonce to allow the resource](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy.
5454
* `fetchPriority`: a string. Suggests a relative priority for fetching the resource. The possible values are `auto` (the default), `high`, and `low`.

src/content/reference/react/useTransition.md

Lines changed: 160 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function CheckoutForm() {
163163

164164
The function passed to `startTransition` is called the "Action". You can update state and (optionally) perform side effects within an Action, and the work will be done in the background without blocking user interactions on the page. A Transition can include multiple Actions, and while a Transition is in progress, your UI stays responsive. For example, if the user clicks a tab but then changes their mind and clicks another tab, the second click will be immediately handled without waiting for the first update to finish.
165165

166-
To give the user feedback about in-progress Transitions, to `isPending` state switches to `true` at the first call to `startTransition`, and stays `true` until all Actions complete and the final state is shown to the user. Transitions ensure side effects in Actions to complete in order to [prevent unwanted loading indicators](#preventing-unwanted-loading-indicators), and you can provide immediate feedback while the Transition is in progress with `useOptimistic`.
166+
To give the user feedback about in-progress Transitions, the `isPending` state switches to `true` at the first call to `startTransition`, and stays `true` until all Actions complete and the final state is shown to the user. Transitions ensure side effects in Actions to complete in order to [prevent unwanted loading indicators](#preventing-unwanted-loading-indicators), and you can provide immediate feedback while the Transition is in progress with `useOptimistic`.
167167

168168
<Recipes titleText="The difference between Actions and regular event handling">
169169

@@ -1948,3 +1948,162 @@ When clicking multiple times, it's possible for previous requests to finish afte
19481948
This is expected, because Actions within a Transition do not guarantee execution order. For common use cases, React provides higher-level abstractions like [`useActionState`](/reference/react/useActionState) and [`<form>` actions](/reference/react-dom/components/form) that handle ordering for you. For advanced use cases, you'll need to implement your own queuing and abort logic to handle this.
19491949
19501950
1951+
Example of `useActionState` handling execution order:
1952+
1953+
<Sandpack>
1954+
1955+
```json package.json hidden
1956+
{
1957+
"dependencies": {
1958+
"react": "beta",
1959+
"react-dom": "beta"
1960+
},
1961+
"scripts": {
1962+
"start": "react-scripts start",
1963+
"build": "react-scripts build",
1964+
"test": "react-scripts test --env=jsdom",
1965+
"eject": "react-scripts eject"
1966+
}
1967+
}
1968+
```
1969+
1970+
```js src/App.js
1971+
import { useState, useActionState } from "react";
1972+
import { updateQuantity } from "./api";
1973+
import Item from "./Item";
1974+
import Total from "./Total";
1975+
1976+
export default function App({}) {
1977+
// Store the actual quantity in separate state to show the mismatch.
1978+
const [clientQuantity, setClientQuantity] = useState(1);
1979+
const [quantity, updateQuantityAction, isPending] = useActionState(
1980+
async (prevState, payload) => {
1981+
setClientQuantity(payload);
1982+
const savedQuantity = await updateQuantity(payload);
1983+
return savedQuantity; // Return the new quantity to update the state
1984+
},
1985+
1 // Initial quantity
1986+
);
1987+
1988+
return (
1989+
<div>
1990+
<h1>Checkout</h1>
1991+
<Item action={updateQuantityAction}/>
1992+
<hr />
1993+
<Total clientQuantity={clientQuantity} savedQuantity={quantity} isPending={isPending} />
1994+
</div>
1995+
);
1996+
}
1997+
1998+
```
1999+
2000+
```js src/Item.js
2001+
import {startTransition} from 'react';
2002+
2003+
export default function Item({action}) {
2004+
function handleChange(e) {
2005+
// Update the quantity in an Action.
2006+
startTransition(() => {
2007+
action(e.target.value);
2008+
});
2009+
}
2010+
return (
2011+
<div className="item">
2012+
<span>Eras Tour Tickets</span>
2013+
<label htmlFor="name">Quantity: </label>
2014+
<input
2015+
type="number"
2016+
onChange={handleChange}
2017+
defaultValue={1}
2018+
min={1}
2019+
/>
2020+
</div>
2021+
)
2022+
}
2023+
```
2024+
2025+
```js src/Total.js
2026+
const intl = new Intl.NumberFormat("en-US", {
2027+
style: "currency",
2028+
currency: "USD"
2029+
});
2030+
2031+
export default function Total({ clientQuantity, savedQuantity, isPending }) {
2032+
return (
2033+
<div className="total">
2034+
<span>Total:</span>
2035+
<div>
2036+
<div>
2037+
{isPending
2038+
? "🌀 Updating..."
2039+
: `${intl.format(savedQuantity * 9999)}`}
2040+
</div>
2041+
<div className="error">
2042+
{!isPending &&
2043+
clientQuantity !== savedQuantity &&
2044+
`Wrong total, expected: ${intl.format(clientQuantity * 9999)}`}
2045+
</div>
2046+
</div>
2047+
</div>
2048+
);
2049+
}
2050+
```
2051+
2052+
```js src/api.js
2053+
let firstRequest = true;
2054+
export async function updateQuantity(newName) {
2055+
return new Promise((resolve, reject) => {
2056+
if (firstRequest === true) {
2057+
firstRequest = false;
2058+
setTimeout(() => {
2059+
firstRequest = true;
2060+
resolve(newName);
2061+
// Simulate every other request being slower
2062+
}, 1000);
2063+
} else {
2064+
setTimeout(() => {
2065+
resolve(newName);
2066+
}, 50);
2067+
}
2068+
});
2069+
}
2070+
```
2071+
2072+
```css
2073+
.item {
2074+
display: flex;
2075+
align-items: center;
2076+
justify-content: start;
2077+
}
2078+
2079+
.item label {
2080+
flex: 1;
2081+
text-align: right;
2082+
}
2083+
2084+
.item input {
2085+
margin-left: 4px;
2086+
width: 60px;
2087+
padding: 4px;
2088+
}
2089+
2090+
.total {
2091+
height: 50px;
2092+
line-height: 25px;
2093+
display: flex;
2094+
align-content: center;
2095+
justify-content: space-between;
2096+
}
2097+
2098+
.total div {
2099+
display: flex;
2100+
flex-direction: column;
2101+
align-items: flex-end;
2102+
}
2103+
2104+
.error {
2105+
color: red;
2106+
}
2107+
```
2108+
2109+
</Sandpack>

src/content/reference/rsc/server-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To support Server Functions as a bundler or framework, we recommend pinning to a
2828

2929
</Note>
3030

31-
When a Server Functions is defined with the [`"use server"`](/reference/rsc/use-server) directive, your framework will automatically create a reference to the server function, and pass that reference to the Client Component. When that function is called on the client, React will send a request to the server to execute the function, and return the result.
31+
When a Server Function is defined with the [`"use server"`](/reference/rsc/use-server) directive, your framework will automatically create a reference to the server function, and pass that reference to the Client Component. When that function is called on the client, React will send a request to the server to execute the function, and return the result.
3232

3333
Server Functions can be created in Server Components and passed as props to Client Components, or they can be imported and used in Client Components.
3434

0 commit comments

Comments
 (0)