Skip to content

Commit f8ed2f8

Browse files
deblasiscursoragent
andcommitted
translate(warnings): all warning pages
Signed-off-by: Alessandro De Blasis <alex@deblasis.net> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 14de661 commit f8ed2f8

6 files changed

Lines changed: 127 additions & 85 deletions

File tree

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
---
2-
title: Invalid ARIA Prop Warning
2+
title: Warning sulle props ARIA non valide
3+
translationStatus: ai-draft
34
---
45

5-
Il warning invalid-aria-prop appare quando provi a renderizzare un elemento del DOM con una aria-* prop che non esiste nella [specifica](https://www.w3.org/TR/wai-aria-1.1/#states_and_properties) Web Accessibility Initiative (WAI) Accessible Rich Internet Application (ARIA).
6+
<Note>
7+
8+
Questa pagina è stata tradotta automaticamente e supervisionata da un maintainer. Un'ulteriore revisione da parte della community sarebbe comunque utile. [Migliora questa traduzione](https://github.com/reactjs/it.react.dev/edit/main/src/content/warnings/invalid-aria-prop.md).
9+
10+
</Note>
11+
12+
Il warning invalid-aria-prop appare quando provi a renderizzare un elemento del DOM con una prop `aria-*` che non esiste nella [specifica](https://www.w3.org/TR/wai-aria-1.1/#states_and_properties) Web Accessibility Initiative (WAI) Accessible Rich Internet Application (ARIA).
613

714
1. Se pensi che la prop che stai usando sia valida, controlla attentamente eventuali errori di battitura. `aria-labelledby` e `aria-activedescendant` sono spesso scritte in modo scorretto.
815

916
2. Se hai scritto `aria-role`, probabilmente intendevi `role`.
1017

11-
3. Altrimenti, se stai utilizzando l'ultima versione di React DOM e verificato che stai usando un nome di proprietà valido presente nella lista della specifica ARIA, cortesemente [riporta un bug](https://github.com/react/react/issues/new/choose).
18+
3. Altrimenti, se stai utilizzando l'ultima versione di React DOM e hai verificato che stai usando un nome di proprietà valido presente nella lista della specifica ARIA, cortesemente [riporta un bug](https://github.com/react/react/issues/new/choose).
Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,75 @@
11
---
2-
title: Rules of Hooks
2+
title: Regole degli Hooks
3+
translationStatus: ai-draft
34
---
45

5-
You are probably here because you got the following error message:
6+
<Note>
7+
8+
Questa pagina è stata tradotta automaticamente e supervisionata da un maintainer. Un'ulteriore revisione da parte della community sarebbe comunque utile. [Migliora questa traduzione](https://github.com/reactjs/it.react.dev/edit/main/src/content/warnings/invalid-hook-call-warning.md).
9+
10+
</Note>
11+
12+
Probabilmente sei qui perché hai ricevuto il seguente messaggio di errore:
613

714
<ConsoleBlock level="error">
815

916
Hooks can only be called inside the body of a function component.
1017

1118
</ConsoleBlock>
1219

13-
There are three common reasons you might be seeing it:
20+
Ci sono tre motivi comuni per cui potresti vederlo:
1421

15-
1. You might be **breaking the Rules of Hooks**.
16-
2. You might have **mismatching versions** of React and React DOM.
17-
3. You might have **more than one copy of React** in the same app.
22+
1. Potresti **violare le Regole degli Hooks**.
23+
2. Potresti avere **versioni non corrispondenti** di React e React DOM.
24+
3. Potresti avere **più di una copia di React** nella stessa app.
1825

19-
Let's look at each of these cases.
26+
Vediamo ciascuno di questi casi.
2027

21-
## Breaking Rules of Hooks {/*breaking-rules-of-hooks*/}
28+
## Violare le Regole degli Hooks {/*breaking-rules-of-hooks*/}
2229

23-
Functions whose names start with `use` are called [*Hooks*](/reference/react) in React.
30+
Le funzioni il cui nome inizia con `use` sono chiamate [*Hooks*](/reference/react) in React.
2431

25-
**Don’t call Hooks inside loops, conditions, or nested functions.** Instead, always use Hooks at the top level of your React function, before any early returns. You can only call Hooks while React is rendering a function component:
32+
**Non chiamare gli Hooks dentro loop, condizioni o funzioni annidate.** Usa invece sempre gli Hooks al top level della tua funzione React, prima di qualsiasi return anticipato. Puoi chiamare gli Hooks solo mentre React sta renderizzando un componente funzione:
2633

27-
*Call them at the top level in the body of a [function component](/learn/your-first-component).
28-
*Call them at the top level in the body of a [custom Hook](/learn/reusing-logic-with-custom-hooks).
34+
*Chiamali al top level nel corpo di un [componente funzione](/learn/your-first-component).
35+
*Chiamali al top level nel corpo di un [custom Hook](/learn/reusing-logic-with-custom-hooks).
2936

3037
```js{2-3,8-9}
3138
function Counter() {
32-
// ✅ Good: top-level in a function component
39+
// ✅ Corretto: top level in un componente funzione
3340
const [count, setCount] = useState(0);
3441
// ...
3542
}
3643
3744
function useWindowWidth() {
38-
// ✅ Good: top-level in a custom Hook
45+
// ✅ Corretto: top level in un custom Hook
3946
const [width, setWidth] = useState(window.innerWidth);
4047
// ...
4148
}
4249
```
4350

44-
It’s **not** supported to call Hooks (functions starting with `use`) in any other cases, for example:
51+
**Non** è supportato chiamare gli Hooks (funzioni che iniziano con `use`) in nessun altro caso, ad esempio:
4552

46-
* 🔴 Do not call Hooks inside conditions or loops.
47-
* 🔴 Do not call Hooks after a conditional `return` statement.
48-
* 🔴 Do not call Hooks in event handlers.
49-
* 🔴 Do not call Hooks in class components.
50-
* 🔴 Do not call Hooks inside functions passed to `useMemo`, `useReducer`, or `useEffect`.
53+
* 🔴 Non chiamare gli Hooks dentro condizioni o loop.
54+
* 🔴 Non chiamare gli Hooks dopo un'istruzione `return` condizionale.
55+
* 🔴 Non chiamare gli Hooks nei gestori di eventi.
56+
* 🔴 Non chiamare gli Hooks nei componenti classe.
57+
* 🔴 Non chiamare gli Hooks dentro funzioni passate a `useMemo`, `useReducer` o `useEffect`.
5158

52-
If you break these rules, you might see this error.
59+
Se violi queste regole, potresti vedere questo errore.
5360

5461
```js{3-4,11-12,20-21}
5562
function Bad({ cond }) {
5663
if (cond) {
57-
// 🔴 Bad: inside a condition (to fix, move it outside!)
64+
// 🔴 Sbagliato: dentro una condizione (per correggere, spostalo fuori!)
5865
const theme = useContext(ThemeContext);
5966
}
6067
// ...
6168
}
6269
6370
function Bad() {
6471
for (let i = 0; i < 10; i++) {
65-
// 🔴 Bad: inside a loop (to fix, move it outside!)
72+
// 🔴 Sbagliato: dentro un loop (per correggere, spostalo fuori!)
6673
const theme = useContext(ThemeContext);
6774
}
6875
// ...
@@ -72,22 +79,22 @@ function Bad({ cond }) {
7279
if (cond) {
7380
return;
7481
}
75-
// 🔴 Bad: after a conditional return (to fix, move it before the return!)
82+
// 🔴 Sbagliato: dopo un return condizionale (per correggere, spostalo prima del return!)
7683
const theme = useContext(ThemeContext);
7784
// ...
7885
}
7986
8087
function Bad() {
8188
function handleClick() {
82-
// 🔴 Bad: inside an event handler (to fix, move it outside!)
89+
// 🔴 Sbagliato: dentro un gestore di eventi (per correggere, spostalo fuori!)
8390
const theme = useContext(ThemeContext);
8491
}
8592
// ...
8693
}
8794
8895
function Bad() {
8996
const style = useMemo(() => {
90-
// 🔴 Bad: inside useMemo (to fix, move it outside!)
97+
// 🔴 Sbagliato: dentro useMemo (per correggere, spostalo fuori!)
9198
const theme = useContext(ThemeContext);
9299
return createStyle(theme);
93100
});
@@ -96,63 +103,63 @@ function Bad() {
96103
97104
class Bad extends React.Component {
98105
render() {
99-
// 🔴 Bad: inside a class component (to fix, write a function component instead of a class!)
106+
// 🔴 Sbagliato: dentro un componente classe (per correggere, scrivi un componente funzione al posto di una classe!)
100107
useEffect(() => {})
101108
// ...
102109
}
103110
}
104111
```
105112

106-
You can use the [`eslint-plugin-react-hooks` plugin](https://www.npmjs.com/package/eslint-plugin-react-hooks) to catch these mistakes.
113+
Puoi usare il plugin [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) per individuare questi errori.
107114

108115
<Note>
109116

110-
[Custom Hooks](/learn/reusing-logic-with-custom-hooks) *may* call other Hooks (that's their whole purpose). This works because custom Hooks are also supposed to only be called while a function component is rendering.
117+
I [custom Hook](/learn/reusing-logic-with-custom-hooks) *possono* chiamare altri Hooks (è proprio il loro scopo). Funziona perché anche i custom Hook dovrebbero essere chiamati solo mentre un componente funzione viene renderizzato.
111118

112119
</Note>
113120

114-
## Mismatching Versions of React and React DOM {/*mismatching-versions-of-react-and-react-dom*/}
121+
## Versioni non corrispondenti di React e React DOM {/*mismatching-versions-of-react-and-react-dom*/}
115122

116-
You might be using a version of `react-dom` (< 16.8.0) or `react-native` (< 0.59) that doesn't yet support Hooks. You can run `npm ls react-dom` or `npm ls react-native` in your application folder to check which version you're using. If you find more than one of them, this might also create problems (more on that below).
123+
Potresti usare una versione di `react-dom` (< 16.8.0) o `react-native` (< 0.59) che non supporta ancora gli Hooks. Puoi eseguire `npm ls react-dom` o `npm ls react-native` nella cartella della tua applicazione per verificare quale versione stai usando. Se ne trovi più di una, questo potrebbe creare problemi (ne parliamo di più sotto).
117124

118-
## Duplicate React {/*duplicate-react*/}
125+
## React duplicato {/*duplicate-react*/}
119126

120-
In order for Hooks to work, the `react` import from your application code needs to resolve to the same module as the `react` import from inside the `react-dom` package.
127+
Affinché gli Hooks funzionino, l'import di `react` dal codice della tua applicazione deve risolvere lo stesso modulo dell'import di `react` dall'interno del pacchetto `react-dom`.
121128

122-
If these `react` imports resolve to two different exports objects, you will see this warning. This may happen if you **accidentally end up with two copies** of the `react` package.
129+
Se questi import di `react` risolvono due oggetti export diversi, vedrai questo warning. Questo può succedere se **finisci accidentalmente con due copie** del pacchetto `react`.
123130

124-
If you use Node for package management, you can run this check in your project folder:
131+
Se usi Node per la gestione dei pacchetti, puoi eseguire questo controllo nella cartella del tuo progetto:
125132

126133
<TerminalBlock>
127134

128135
npm ls react
129136

130137
</TerminalBlock>
131138

132-
If you see more than one React, you'll need to figure out why this happens and fix your dependency tree. For example, maybe a library you're using incorrectly specifies `react` as a dependency (rather than a peer dependency). Until that library is fixed, [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/) is one possible workaround.
139+
Se vedi più di un React, dovrai capire perché succede e correggere l'albero delle dipendenze. Ad esempio, forse una libreria che usi specifica `react` in modo errato come dipendenza (invece che come peer dependency). Finché quella libreria non viene corretta, le [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/) sono una possibile soluzione temporanea.
133140

134-
You can also try to debug this problem by adding some logs and restarting your development server:
141+
Puoi anche provare a debuggare questo problema aggiungendo alcuni log e riavviando il server di sviluppo:
135142

136143
```js
137-
// Add this in node_modules/react-dom/index.js
144+
// Aggiungi questo in node_modules/react-dom/index.js
138145
window.React1 = require('react');
139146

140-
// Add this in your component file
147+
// Aggiungi questo nel file del tuo componente
141148
require('react-dom');
142149
window.React2 = require('react');
143150
console.log(window.React1 === window.React2);
144151
```
145152

146-
If it prints `false` then you might have two Reacts and need to figure out why that happened. [This issue](https://github.com/react/react/issues/13991) includes some common reasons encountered by the community.
153+
Se stampa `false`, potresti avere due React e devi capire perché è successo. [Questa issue](https://github.com/react/react/issues/13991) include alcuni motivi comuni riscontrati dalla community.
147154

148-
This problem can also come up when you use `npm link` or an equivalent. In that case, your bundler might "see" two Reactsone in application folder and one in your library folder. Assuming `myapp` and `mylib` are sibling folders, one possible fix is to run `npm link ../myapp/node_modules/react` from `mylib`. This should make the library use the application's React copy.
155+
Questo problema può presentarsi anche quando usi `npm link` o un equivalente. In quel caso, il tuo bundler potrebbe "vedere" due Reactuno nella cartella dell'applicazione e uno nella cartella della tua libreria. Supponendo che `myapp` e `mylib` siano cartelle sorelle, una possibile correzione è eseguire `npm link ../myapp/node_modules/react` da `mylib`. In questo modo la libreria userà la copia di React dell'applicazione.
149156

150157
<Note>
151158

152-
In general, React supports using multiple independent copies on one page (for example, if an app and a third-party widget both use it). It only breaks if `require('react')` resolves differently between the component and the `react-dom` copy it was rendered with.
159+
In generale, React supporta l'uso di più copie indipendenti nella stessa pagina (ad esempio, se un'app e un widget di terze parti lo usano entrambi). Si rompe solo se `require('react')` risolve in modo diverso tra il componente e la copia di `react-dom` con cui è stato renderizzato.
153160

154161
</Note>
155162

156-
## Other Causes {/*other-causes*/}
163+
## Altre cause {/*other-causes*/}
157164

158-
If none of this worked, please comment in [this issue](https://github.com/react/react/issues/13991) and we'll try to help. Try to create a small reproducing exampleyou might discover the problem as you're doing it.
165+
Se niente di tutto ciò ha funzionato, commenta in [questa issue](https://github.com/react/react/issues/13991) e cercheremo di aiutarti. Prova a creare un piccolo esempio riproducibilepotresti scoprire il problema mentre lo fai.

src/content/warnings/react-dom-test-utils.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,49 @@
11
---
2-
title: react-dom/test-utils Deprecation Warnings
2+
title: Warning di deprecazione react-dom/test-utils
3+
translationStatus: ai-draft
34
---
45

5-
## ReactDOMTestUtils.act() warning {/*reactdomtestutilsact-warning*/}
6+
<Note>
67

7-
`act` from `react-dom/test-utils` has been deprecated in favor of `act` from `react`.
8+
Questa pagina è stata tradotta automaticamente e supervisionata da un maintainer. Un'ulteriore revisione da parte della community sarebbe comunque utile. [Migliora questa traduzione](https://github.com/reactjs/it.react.dev/edit/main/src/content/warnings/react-dom-test-utils.md).
89

9-
Before:
10+
</Note>
11+
12+
## Warning ReactDOMTestUtils.act() {/*reactdomtestutilsact-warning*/}
13+
14+
`act` da `react-dom/test-utils` è deprecato in favore di `act` da `react`.
15+
16+
Prima:
1017

1118
```js
1219
import {act} from 'react-dom/test-utils';
1320
```
1421

15-
After:
22+
Dopo:
1623

1724
```js
1825
import {act} from 'react';
1926
```
2027

21-
## Rest of ReactDOMTestUtils APIS {/*rest-of-reactdomtestutils-apis*/}
28+
## Resto delle API ReactDOMTestUtils {/*rest-of-reactdomtestutils-apis*/}
2229

23-
All APIs except `act` have been removed.
30+
Tutte le API tranne `act` sono state rimosse.
2431

25-
The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) for a modern and well supported testing experience.
32+
Il team React consiglia di migrare i tuoi test a [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) per un'esperienza di testing moderna e ben supportata.
2633

2734
### ReactDOMTestUtils.renderIntoDocument {/*reactdomtestutilsrenderintodocument*/}
2835

29-
`renderIntoDocument` can be replaced with `render` from `@testing-library/react`.
36+
`renderIntoDocument` può essere sostituito con `render` da `@testing-library/react`.
3037

31-
Before:
38+
Prima:
3239

3340
```js
3441
import {renderIntoDocument} from 'react-dom/test-utils';
3542

3643
renderIntoDocument(<Component />);
3744
```
3845

39-
After:
46+
Dopo:
4047

4148
```js
4249
import {render} from '@testing-library/react';
@@ -46,9 +53,9 @@ render(<Component />);
4653

4754
### ReactDOMTestUtils.Simulate {/*reactdomtestutilssimulate*/}
4855

49-
`Simulate` can be replaced with `fireEvent` from `@testing-library/react`.
56+
`Simulate` può essere sostituito con `fireEvent` da `@testing-library/react`.
5057

51-
Before:
58+
Prima:
5259

5360
```js
5461
import {Simulate} from 'react-dom/test-utils';
@@ -57,7 +64,7 @@ const element = document.querySelector('button');
5764
Simulate.click(element);
5865
```
5966

60-
After:
67+
Dopo:
6168

6269
```js
6370
import {fireEvent} from '@testing-library/react';
@@ -66,9 +73,9 @@ const element = document.querySelector('button');
6673
fireEvent.click(element);
6774
```
6875

69-
Be aware that `fireEvent` dispatches an actual event on the element and doesn't just synthetically call the event handler.
76+
Tieni presente che `fireEvent` invia un evento reale sull'elemento e non chiama solo sinteticamente il gestore di eventi.
7077

71-
### List of all removed APIs {/*list-of-all-removed-apis-list-of-all-removed-apis*/}
78+
### Elenco di tutte le API rimosse {/*list-of-all-removed-apis-list-of-all-removed-apis*/}
7279

7380
- `mockComponent()`
7481
- `isElement()`
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
---
2-
title: react-test-renderer Deprecation Warnings
2+
title: Warning di deprecazione react-test-renderer
3+
translationStatus: ai-draft
34
---
45

5-
## ReactTestRenderer.create() warning {/*reacttestrenderercreate-warning*/}
6+
<Note>
67

7-
react-test-renderer is deprecated. A warning will fire whenever calling ReactTestRenderer.create() or ReactShallowRender.render(). The react-test-renderer package will remain available on NPM but will not be maintained and may break with new React features or changes to React's internals.
8+
Questa pagina è stata tradotta automaticamente e supervisionata da un maintainer. Un'ulteriore revisione da parte della community sarebbe comunque utile. [Migliora questa traduzione](https://github.com/reactjs/it.react.dev/edit/main/src/content/warnings/react-test-renderer.md).
89

9-
The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/start/intro) for a modern and well supported testing experience.
10+
</Note>
1011

12+
## Warning ReactTestRenderer.create() {/*reacttestrenderercreate-warning*/}
1113

12-
## new ShallowRenderer() warning {/*new-shallowrenderer-warning*/}
14+
react-test-renderer è deprecato. Un warning viene mostrato ogni volta che chiami `ReactTestRenderer.create()` o `ReactShallowRender.render()`. Il pacchetto react-test-renderer resterà disponibile su NPM ma non sarà mantenuto e potrebbe rompersi con nuove funzionalità di React o modifiche agli internals di React.
1315

14-
The react-test-renderer package no longer exports a shallow renderer at `react-test-renderer/shallow`. This was simply a repackaging of a previously extracted separate package: `react-shallow-renderer`. Therefore you can continue using the shallow renderer in the same way by installing it directly. See [Github](https://github.com/enzymejs/react-shallow-renderer) / [NPM](https://www.npmjs.com/package/react-shallow-renderer).
16+
Il team React consiglia di migrare i tuoi test a [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) o [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/start/intro) per un'esperienza di testing moderna e ben supportata.
17+
18+
19+
## Warning new ShallowRenderer() {/*new-shallowrenderer-warning*/}
20+
21+
Il pacchetto react-test-renderer non esporta più uno shallow renderer in `react-test-renderer/shallow`. Era semplicemente un reimpacchettamento di un pacchetto separato estratto in precedenza: `react-shallow-renderer`. Puoi quindi continuare a usare lo shallow renderer nello stesso modo installandolo direttamente. Vedi [Github](https://github.com/enzymejs/react-shallow-renderer) / [NPM](https://www.npmjs.com/package/react-shallow-renderer).

0 commit comments

Comments
 (0)