Skip to content

Commit

Permalink
merging all conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
react-translations-bot committed Sep 2, 2024
2 parents 4dffa0f + c2d6131 commit 524af94
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/content/blog/2023/03/16/introducing-react-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Use the conditional operator (`cond ? a : b`) to render a ❌ if `isPacked` isn
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down Expand Up @@ -307,7 +307,7 @@ export default function PackingList() {
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked ? '' : ''}
{name} {isPacked ? '' : ''}
</li>
);
}
Expand Down
5 changes: 5 additions & 0 deletions src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ October 18, 2024. In-person in Brussels, Belgium (hybrid event)

[Website](https://www.react.brussels/) - [Twitter](https://x.com/BrusselsReact)

### React Advanced London 2024 {/*react-advanced-london-2024*/}
October 25 & 28, 2024. In-person in London, UK + online (hybrid event)

[Website](https://reactadvanced.com/) - [Twitter](https://x.com/reactadvanced)

### React Africa 2024 {/*react-africa-2024*/}
November 29, 2024. In-person in Casablanca, Morocco (hybrid event)

Expand Down
36 changes: 22 additions & 14 deletions src/content/learn/conditional-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ export default function PackingList() {
</Sandpack>
<<<<<<< HEAD
لاحظ أن بعض مكونات `Item` لديها خاصية `isPacked` معينة إلى `true` بدلا من `false`. ترغب في إضافة علامة التحقق (✔) إلى العناصر المحزومة في حالة `isPacked={true}`.
=======
Notice that some of the `Item` components have their `isPacked` prop set to `true` instead of `false`. You want to add a checkmark (✅) to packed items if `isPacked={true}`.
>>>>>>> c2d61310664cc0d94f89ca21fc1d44e674329799
يمكنك كتابة ذلك باستخدام [عبارة `if`/`else`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else) على النحو التالي:
```js
if (isPacked) {
return <li className="item">{name} </li>;
return <li className="item">{name} </li>;
}
return <li className="item">{name}</li>;
```
Expand All @@ -70,7 +74,7 @@ return <li className="item">{name}</li>;
```js
function Item({ name, isPacked }) {
if (isPacked) {
return <li className="item">{name} </li>;
return <li className="item">{name} </li>;
}
return <li className="item">{name}</li>;
}
Expand Down Expand Up @@ -159,7 +163,7 @@ export default function PackingList() {
في المثال السابق، تحكمت في شجرة JSX (إن وجدت!) التي سيُرجعها المكون. ربما لاحظت بالفعل بعض التكرار في ناتج العرض:
```js
<li className="item">{name} </li>
<li className="item">{name} </li>
```
مشابه جدًا لـ
Expand All @@ -172,7 +176,7 @@ export default function PackingList() {
```js
if (isPacked) {
return <li className="item">{name} </li>;
return <li className="item">{name} </li>;
}
return <li className="item">{name}</li>;
```
Expand All @@ -187,7 +191,7 @@ return <li className="item">{name}</li>;
```js
if (isPacked) {
return <li className="item">{name} </li>;
return <li className="item">{name} </li>;
}
return <li className="item">{name}</li>;
```
Expand All @@ -197,12 +201,16 @@ return <li className="item">{name}</li>;
```js
return (
<li className="item">
{isPacked ? name + ' ' : name}
{isPacked ? name + ' ' : name}
</li>
);
```
<<<<<<< HEAD
يمكنك قرائتها على النحو التالي *”إذا كان `isPacked` صحيحا، إذا قم بعرض `name + ''`، وإلا (`:`) قم بعرض `name`“.*
=======
You can read it as *"if `isPacked` is true, then (`?`) render `name + ''`, otherwise (`:`) render `name`"*.
>>>>>>> c2d61310664cc0d94f89ca21fc1d44e674329799
<DeepDive>
Expand All @@ -222,7 +230,7 @@ function Item({ name, isPacked }) {
<li className="item">
{isPacked ? (
<del>
{name + ' '}
{name + ' '}
</del>
) : (
name
Expand Down Expand Up @@ -265,7 +273,7 @@ export default function PackingList() {
```js
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
```
Expand All @@ -280,7 +288,7 @@ return (
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down Expand Up @@ -336,7 +344,7 @@ let itemContent = name;
```js
if (isPacked) {
itemContent = name + " ";
itemContent = name + " ";
}
```
Expand All @@ -356,7 +364,7 @@ if (isPacked) {
function Item({ name, isPacked }) {
let itemContent = name;
if (isPacked) {
itemContent = name + " ";
itemContent = name + " ";
}
return (
<li className="item">
Expand Down Expand Up @@ -400,7 +408,7 @@ function Item({ name, isPacked }) {
if (isPacked) {
itemContent = (
<del>
{name + " "}
{name + " "}
</del>
);
}
Expand Down Expand Up @@ -461,7 +469,7 @@ export default function PackingList() {
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down Expand Up @@ -499,7 +507,7 @@ export default function PackingList() {
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked ? '' : ''}
{name} {isPacked ? '' : ''}
</li>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/describing-the-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export function getImageUrl(person, size = 's') {
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/content/learn/you-might-not-need-an-effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ function Game() {
There are two problems with this code.
One problem is that it is very inefficient: the component (and its children) have to re-render between each `set` call in the chain. In the example above, in the worst case (`setCard` → render → `setGoldCardCount` → render → `setRound` → render → `setIsGameOver` → render) there are three unnecessary re-renders of the tree below.
First problem is that it is very inefficient: the component (and its children) have to re-render between each `set` call in the chain. In the example above, in the worst case (`setCard` → render → `setGoldCardCount` → render → `setRound` → render → `setIsGameOver` → render) there are three unnecessary re-renders of the tree below.
Even if it weren't slow, as your code evolves, you will run into cases where the "chain" you wrote doesn't fit the new requirements. Imagine you are adding a way to step through the history of the game moves. You'd do it by updating each state variable to a value from the past. However, setting the `card` state to a value from the past would trigger the Effect chain again and change the data you're showing. Such code is often rigid and fragile.
The second problem is that even if it weren't slow, as your code evolves, you will run into cases where the "chain" you wrote doesn't fit the new requirements. Imagine you are adding a way to step through the history of the game moves. You'd do it by updating each state variable to a value from the past. However, setting the `card` state to a value from the past would trigger the Effect chain again and change the data you're showing. Such code is often rigid and fragile.
In this case, it's better to calculate what you can during rendering, and adjust the state in the event handler:
Expand Down
2 changes: 1 addition & 1 deletion src/content/reference/react-dom/components/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ They are special in React because passing the `value` prop to them makes them *[

## Resource and Metadata Components {/*resource-and-metadata-components*/}

These bulit-in browser components let you load external resources or annotate the document with metadata:
These built-in browser components let you load external resources or annotate the document with metadata:

* [`<link>`](/reference/react-dom/components/link)
* [`<meta>`](/reference/react-dom/components/meta)
Expand Down
2 changes: 1 addition & 1 deletion src/content/reference/react/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The React reference documentation is broken down into functional subsections:
Programmatic React features:

* [Hooks](/reference/react/hooks) - Use different React features from your components.
* [Components](/reference/react/components) - Documents built-in components that you can use in your JSX.
* [Components](/reference/react/components) - Built-in components that you can use in your JSX.
* [APIs](/reference/react/apis) - APIs that are useful for defining components.
* [Directives](/reference/rsc/directives) - Provide instructions to bundlers compatible with React Server Components.

Expand Down
5 changes: 5 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"destination": "/learn/rendering-lists#keeping-list-items-in-order-with-key",
"permanent": false
},
{
"source": "/docs/lists-and-keys",
"destination": "/learn/rendering-lists#keeping-list-items-in-order-with-key",
"permanent": false
},
{
"source": "/link/invalid-hook-call",
"destination": "/warnings/invalid-hook-call-warning",
Expand Down

0 comments on commit 524af94

Please sign in to comment.