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 Aug 26, 2024
2 parents 4910ba3 + 7d50c3f commit 389100d
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 23 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
4 changes: 4 additions & 0 deletions src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ September 19-21, 2024. Alicante, Spain.

[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/ReactAlicante) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)

### RenderCon Kenya 2024 {/*rendercon-kenya-2024*/}
October 04 - 05, 2024. Nairobi, Kenya

[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)

### React India 2024 {/*react-india-2024*/}
October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - remote day
Expand Down
4 changes: 4 additions & 0 deletions src/content/learn/adding-interactivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ setCount(count + 1); // Richiedi un re-render con 1
console.log(count); // Ancora 0!
```

<<<<<<< HEAD
Questo comportamento aiuta a evitare bug difficili da individuare. Ecco una piccola app di messaggistica. Prova a indovinare cosa succede se premi "Send" e *poi* selezioni il destinatario Bob. Quale nome apparirà nell'`alert` cinque secondi dopo?
=======
This behavior helps you avoid subtle bugs. Here is a little chat app. Try to guess what happens if you press "Send" first and *then* change the recipient to Bob. Whose name will appear in the `alert` five seconds later?
>>>>>>> 7d50c3ffd4df2dc7903f4e41069653a456a9c223
<Sandpack>

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
Nota che alcuni componenti `Item` hanno la loro prop `isPacked` settata a `true` invece che `false`. Vuoi aggiungere un segno di spunta (✔) agli elementi imballati se `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}`.
>>>>>>> 7d50c3ffd4df2dc7903f4e41069653a456a9c223
Puoi scrivere questo come un'[istruzione `if`/`else`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else) in questo modo:

```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 @@ Se la prop `isPacked` è `true`, questo codice **ritorna un albero JSX different
```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 @@ Nella pratica, ritornare `null` da un componente non è comune perché potrebbe
Nell'esempio precedente, hai controllato quale albero JSX sarebbe stato ritornato dal componente (se presente!). Potresti aver già notato qualche duplicazione nell'output renderizzato:

```js
<li className="item">{name} </li>
<li className="item">{name} </li>
```

è molto simile a
Expand All @@ -172,7 +176,7 @@ Entrambi i rami condizionali ritornano `<li className="item">...</li>`:

```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 @@ Invece di questo:
```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 @@ Puoi scrivere questo:
```js
return (
<li className="item">
{isPacked ? name + ' ' : name}
{isPacked ? name + ' ' : name}
</li>
);
```
<<<<<<< HEAD
Puoi leggerlo come *"se `isPacked` è true, allora (`?`) renderizza `name + ''`, altrimenti (`:`) renderizza `name`"*.
=======
You can read it as *"if `isPacked` is true, then (`?`) render `name + ''`, otherwise (`:`) render `name`"*.
>>>>>>> 7d50c3ffd4df2dc7903f4e41069653a456a9c223
<DeepDive>
Expand All @@ -222,7 +230,7 @@ function Item({ name, isPacked }) {
<li className="item">
{isPacked ? (
<del>
{name + ' '}
{name + ' '}
</del>
) : (
name
Expand Down Expand Up @@ -266,7 +274,7 @@ Un'altra scorciatoia comune che incontrerai è l'[operatore logico AND (`&&`).](
```js
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
```
Expand All @@ -281,7 +289,7 @@ Eccolo in azione:
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down Expand Up @@ -337,7 +345,7 @@ Utilizza un'istruzione `if` per riassegnare un'espressione JSX ad `itemContent`

```js
if (isPacked) {
itemContent = name + " ";
itemContent = name + " ";
}
```

Expand All @@ -357,7 +365,7 @@ Questo stile è più verboso, ma è anche più flessibile. Ecco come funziona:
function Item({ name, isPacked }) {
let itemContent = name;
if (isPacked) {
itemContent = name + " ";
itemContent = name + " ";
}
return (
<li className="item">
Expand Down Expand Up @@ -401,7 +409,7 @@ function Item({ name, isPacked }) {
if (isPacked) {
itemContent = (
<del>
{name + " "}
{name + " "}
</del>
);
}
Expand Down Expand Up @@ -464,7 +472,7 @@ Usa l'operatore condizionale (`cond ? a : b`) per renderizzare una ❌ se `isPac
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down Expand Up @@ -502,7 +510,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 @@ In questo esempio, l'operatore `&&` di JavaScript viene utilizzato per renderizz
function Item({ name, isPacked }) {
return (
<li className="item">
{name} {isPacked && ''}
{name} {isPacked && ''}
</li>
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/content/learn/react-compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ In addition to these docs, we recommend checking the [React Compiler Working Gro
Prior to installing the compiler, you can first check to see if your codebase is compatible:

<TerminalBlock>
npx react-compiler-healthcheck@latest
npx react-compiler-healthcheck@experimental
</TerminalBlock>

This script will:
Expand All @@ -143,7 +143,7 @@ Found no usage of incompatible libraries.
React Compiler also powers an eslint plugin. The eslint plugin can be used **independently** of the compiler, meaning you can use the eslint plugin even if you don't use the compiler.

<TerminalBlock>
npm install eslint-plugin-react-compiler
npm install eslint-plugin-react-compiler@experimental
</TerminalBlock>

Then, add it to your eslint config:
Expand Down Expand Up @@ -203,7 +203,7 @@ If you're starting a new project, you can enable the compiler on your entire cod
### Babel {/*usage-with-babel*/}

<TerminalBlock>
npm install babel-plugin-react-compiler
npm install babel-plugin-react-compiler@experimental
</TerminalBlock>

The compiler includes a Babel plugin which you can use in your build pipeline to run the compiler.
Expand Down Expand Up @@ -258,7 +258,7 @@ Next.js has an experimental configuration to enable the React Compiler. It autom
- Install `babel-plugin-react-compiler`

<TerminalBlock>
npm install next@canary babel-plugin-react-compiler
npm install next@canary babel-plugin-react-compiler@experimental
</TerminalBlock>

Then configure the experimental option in `next.config.js`:
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: 2 additions & 0 deletions src/content/reference/react/useLayoutEffect.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function Tooltip() {
* The code inside `useLayoutEffect` and all state updates scheduled from it **block the browser from repainting the screen.** When used excessively, this makes your app slow. When possible, prefer [`useEffect`.](/reference/react/useEffect)
* If you trigger a state update inside `useLayoutEffect`, React will execute all remaining Effects immediately including `useEffect`.
---
## Usage {/*usage*/}
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 389100d

Please sign in to comment.