Skip to content

Commit fca3217

Browse files
authored
Merge pull request #595 from reactjs/sync-6326e7b1
Sync with react.dev @ 6326e7b Translate Adding Interactivity
2 parents 72cc366 + dbc2f90 commit fca3217

8 files changed

+180
-180
lines changed

.github/workflows/discord_notify.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Discord Notify
22

33
on:
44
pull_request_target:
5-
types: [labeled]
5+
types: [opened, ready_for_review]
66

77
jobs:
88
check_maintainer:

src/content/blog/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: React Blog
66

77
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.
88

9-
You can also follow the [@react.dev](https://bsky.app/profiles/react.js) 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+
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.
1010

1111
</Intro>
1212

src/content/learn/adding-interactivity.md

+145-145
Large diffs are not rendered by default.

src/content/learn/passing-data-deeply-with-context.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -468,15 +468,15 @@ import { LevelContext } from './LevelContext.js';
468468
export default function Section({ level, children }) {
469469
return (
470470
<section className="section">
471-
<LevelContext.Provider value={level}>
471+
<LevelContext value={level}>
472472
{children}
473-
</LevelContext.Provider>
473+
</LevelContext>
474474
</section>
475475
);
476476
}
477477
```
478478

479-
This tells React: "if any component inside this `<Section>` asks for `LevelContext`, give them this `level`." The component will use the value of the nearest `<LevelContext.Provider>` in the UI tree above it.
479+
This tells React: "if any component inside this `<Section>` asks for `LevelContext`, give them this `level`." The component will use the value of the nearest `<LevelContext>` in the UI tree above it.
480480

481481
<Sandpack>
482482

@@ -514,9 +514,9 @@ import { LevelContext } from './LevelContext.js';
514514
export default function Section({ level, children }) {
515515
return (
516516
<section className="section">
517-
<LevelContext.Provider value={level}>
517+
<LevelContext value={level}>
518518
{children}
519-
</LevelContext.Provider>
519+
</LevelContext>
520520
</section>
521521
);
522522
}
@@ -567,7 +567,7 @@ export const LevelContext = createContext(1);
567567
It's the same result as the original code, but you did not need to pass the `level` prop to each `Heading` component! Instead, it "figures out" its heading level by asking the closest `Section` above:
568568

569569
1. You pass a `level` prop to the `<Section>`.
570-
2. `Section` wraps its children into `<LevelContext.Provider value={level}>`.
570+
2. `Section` wraps its children into `<LevelContext value={level}>`.
571571
3. `Heading` asks the closest value of `LevelContext` above with `useContext(LevelContext)`.
572572

573573
## Using and providing context from the same component {/*using-and-providing-context-from-the-same-component*/}
@@ -595,9 +595,9 @@ export default function Section({ children }) {
595595
const level = useContext(LevelContext);
596596
return (
597597
<section className="section">
598-
<LevelContext.Provider value={level + 1}>
598+
<LevelContext value={level + 1}>
599599
{children}
600-
</LevelContext.Provider>
600+
</LevelContext>
601601
</section>
602602
);
603603
}
@@ -643,9 +643,9 @@ export default function Section({ children }) {
643643
const level = useContext(LevelContext);
644644
return (
645645
<section className="section">
646-
<LevelContext.Provider value={level + 1}>
646+
<LevelContext value={level + 1}>
647647
{children}
648-
</LevelContext.Provider>
648+
</LevelContext>
649649
</section>
650650
);
651651
}
@@ -776,9 +776,9 @@ export default function Section({ children, isFancy }) {
776776
'section ' +
777777
(isFancy ? 'fancy' : '')
778778
}>
779-
<LevelContext.Provider value={level + 1}>
779+
<LevelContext value={level + 1}>
780780
{children}
781-
</LevelContext.Provider>
781+
</LevelContext>
782782
</section>
783783
);
784784
}
@@ -868,7 +868,7 @@ In general, if some information is needed by distant components in different par
868868
* To pass context:
869869
1. Create and export it with `export const MyContext = createContext(defaultValue)`.
870870
2. Pass it to the `useContext(MyContext)` Hook to read it in any child component, no matter how deep.
871-
3. Wrap children into `<MyContext.Provider value={...}>` to provide it from a parent.
871+
3. Wrap children into `<MyContext value={...}>` to provide it from a parent.
872872
* Context passes through any components in the middle.
873873
* Context lets you write components that "adapt to their surroundings".
874874
* Before you use context, try passing props or passing JSX as `children`.
@@ -1022,7 +1022,7 @@ li {
10221022
10231023
Remove `imageSize` prop from all the components.
10241024
1025-
Create and export `ImageSizeContext` from `Context.js`. Then wrap the List into `<ImageSizeContext.Provider value={imageSize}>` to pass the value down, and `useContext(ImageSizeContext)` to read it in the `PlaceImage`:
1025+
Create and export `ImageSizeContext` from `Context.js`. Then wrap the List into `<ImageSizeContext value={imageSize}>` to pass the value down, and `useContext(ImageSizeContext)` to read it in the `PlaceImage`:
10261026
10271027
<Sandpack>
10281028
@@ -1036,7 +1036,7 @@ export default function App() {
10361036
const [isLarge, setIsLarge] = useState(false);
10371037
const imageSize = isLarge ? 150 : 100;
10381038
return (
1039-
<ImageSizeContext.Provider
1039+
<ImageSizeContext
10401040
value={imageSize}
10411041
>
10421042
<label>
@@ -1051,7 +1051,7 @@ export default function App() {
10511051
</label>
10521052
<hr />
10531053
<List />
1054-
</ImageSizeContext.Provider>
1054+
</ImageSizeContext>
10551055
)
10561056
}
10571057

src/content/learn/responding-to-events.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ button { margin-right: 10px; }
332332
export default function Toolbar() {
333333
return (
334334
<div className="Toolbar" onClick={() => {
335-
alert('You clicked on the toolbar!');
335+
alert('Ви натиснули на панель інструментів!');
336336
}}>
337337
<button onClick={() => alert('Відтворюється!')}>
338338
Відтворити фільм
@@ -386,7 +386,7 @@ function Button({ onClick, children }) {
386386
export default function Toolbar() {
387387
return (
388388
<div className="Toolbar" onClick={() => {
389-
alert('You clicked on the toolbar!');
389+
alert('Ви натиснули на панель інструментів!');
390390
}}>
391391
<Button onClick={() => alert('Відтворюється!')}>
392392
Відтворити фільм

src/content/learn/updating-arrays-in-state.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,9 @@ button { margin-left: 5px; }
410410
import { useState } from 'react';
411411

412412
const initialList = [
413-
{ id: 0, title: 'Великі животи' },
414-
{ id: 1, title: 'Місячний пейзаж' },
415-
{ id: 2, title: 'Теракотова армія' },
413+
{ id: 0, title: 'Великі животи (Big Bellies)' },
414+
{ id: 1, title: 'Місячний пейзаж (Lunar Landscape)' },
415+
{ id: 2, title: 'Теракотова армія (Terracotta Army)' },
416416
];
417417

418418
export default function List() {
@@ -468,9 +468,9 @@ import { useState } from 'react';
468468

469469
let nextId = 3;
470470
const initialList = [
471-
{ id: 0, title: 'Великі животи', seen: false },
472-
{ id: 1, title: 'Місячний пейзаж', seen: false },
473-
{ id: 2, title: 'Теракотова армія', seen: true },
471+
{ id: 0, title: 'Великі животи (Big Bellies)', seen: false },
472+
{ id: 1, title: 'Місячний пейзаж (Lunar Landscape)', seen: false },
473+
{ id: 2, title: 'Теракотова армія (Terracotta Army)', seen: true },
474474
];
475475

476476
export default function BucketList() {
@@ -575,9 +575,9 @@ import { useState } from 'react';
575575

576576
let nextId = 3;
577577
const initialList = [
578-
{ id: 0, title: 'Великі животи', seen: false },
579-
{ id: 1, title: 'Місячний пейзаж', seen: false },
580-
{ id: 2, title: 'Теракотова армія', seen: true },
578+
{ id: 0, title: 'Великі животи (Big Bellies)', seen: false },
579+
{ id: 1, title: 'Місячний пейзаж (Lunar Landscape)', seen: false },
580+
{ id: 2, title: 'Теракотова армія (Terracotta Army)', seen: true },
581581
];
582582

583583
export default function BucketList() {
@@ -671,9 +671,9 @@ import { useImmer } from 'use-immer';
671671

672672
let nextId = 3;
673673
const initialList = [
674-
{ id: 0, title: 'Великі животи', seen: false },
675-
{ id: 1, title: 'Місячний пейзаж', seen: false },
676-
{ id: 2, title: 'Теракотова армія', seen: true },
674+
{ id: 0, title: 'Великі животи (Big Bellies)', seen: false },
675+
{ id: 1, title: 'Місячний пейзаж (Lunar Landscape)', seen: false },
676+
{ id: 2, title: 'Теракотова армія (Terracotta Army)', seen: true },
677677
];
678678

679679
export default function BucketList() {

src/content/reference/react-dom/client/hydrateRoot.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ An app fully built with React will usually not have any calls to `root.unmount`.
9999
100100
This is mostly useful if your React root's DOM node (or any of its ancestors) may get removed from the DOM by some other code. For example, imagine a jQuery tab panel that removes inactive tabs from the DOM. If a tab gets removed, everything inside it (including the React roots inside) would get removed from the DOM as well. You need to tell React to "stop" managing the removed root's content by calling `root.unmount`. Otherwise, the components inside the removed root won't clean up and free up resources like subscriptions.
101101
102-
Calling `root.unmount` will unmount all the components in the root and "detach" React from the root DOM node, including removing any event handlers or state in the tree.
102+
Calling `root.unmount` will unmount all the components in the root and "detach" React from the root DOM node, including removing any event handlers or state in the tree.
103103
104104
105105
#### Parameters {/*root-unmount-parameters*/}
@@ -270,7 +270,7 @@ export default function App() {
270270
271271
</Sandpack>
272272
273-
This only works one level deep, and is intended to be an escape hatch. Don’t overuse it. Unless it’s text content, React still won’t attempt to patch it up, so it may remain inconsistent until future updates.
273+
This only works one level deep, and is intended to be an escape hatch. Don’t overuse it. React will **not** attempt to patch mismatched text content.
274274
275275
---
276276

src/sidebarLearn.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
]
110110
},
111111
{
112-
"title": "Adding Interactivity",
112+
"title": "Додавання інтерактивності",
113113
"path": "/learn/adding-interactivity",
114114
"tags": [],
115115
"routes": [

0 commit comments

Comments
 (0)