diff --git a/src/content/reference/react/createContext.md b/src/content/reference/react/createContext.md
index e4e9bcf62..2645896fd 100644
--- a/src/content/reference/react/createContext.md
+++ b/src/content/reference/react/createContext.md
@@ -1,10 +1,17 @@
---
title: createContext
+translationStatus: ai-draft
---
+
+
+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/reference/react/createContext.md).
+
+
+
-`createContext` lets you create a [context](/learn/passing-data-deeply-with-context) that components can provide or read.
+`createContext` ti permette di creare un [context](/learn/passing-data-deeply-with-context) che i componenti possono fornire o leggere.
```js
const SomeContext = createContext(defaultValue)
@@ -20,7 +27,7 @@ const SomeContext = createContext(defaultValue)
### `createContext(defaultValue)` {/*createcontext*/}
-Call `createContext` outside of any components to create a context.
+Chiama `createContext` al di fuori di qualsiasi componente per creare un context.
```js
import { createContext } from 'react';
@@ -28,27 +35,27 @@ import { createContext } from 'react';
const ThemeContext = createContext('light');
```
-[See more examples below.](#usage)
+[Vedi altri esempi sotto.](#usage)
#### Parameters {/*parameters*/}
-* `defaultValue`: The value that you want the context to have when there is no matching context provider in the tree above the component that reads context. If you don't have any meaningful default value, specify `null`. The default value is meant as a "last resort" fallback. It is static and never changes over time.
+* `defaultValue`: Il valore che vuoi che il context abbia quando non c'è un context provider corrispondente nell'albero sopra il componente che legge il context. Se non hai un valore predefinito significativo, specifica `null`. Il valore predefinito è pensato come fallback "d'ultima risorsa". È statico e non cambia mai nel tempo.
#### Returns {/*returns*/}
-`createContext` returns a context object.
+`createContext` restituisce un oggetto context.
-**The context object itself does not hold any information.** It represents _which_ context other components read or provide. Typically, you will use [`SomeContext`](#provider) in components above to specify the context value, and call [`useContext(SomeContext)`](/reference/react/useContext) in components below to read it. The context object has a few properties:
+**L'oggetto context in sé non contiene alcuna informazione.** Rappresenta _quale_ context altri componenti leggono o forniscono. In genere, userai [`SomeContext`](#provider) nei componenti sopra per specificare il valore del context, e chiamerai [`useContext(SomeContext)`](/reference/react/useContext) nei componenti sotto per leggerlo. L'oggetto context ha alcune proprietà:
-* `SomeContext` lets you provide the context value to components.
-* `SomeContext.Consumer` is an alternative and rarely used way to read the context value.
-* `SomeContext.Provider` is a legacy way to provide the context value before React 19.
+* `SomeContext` ti permette di fornire il valore del context ai componenti.
+* `SomeContext.Consumer` è un modo alternativo e raramente usato per leggere il valore del context.
+* `SomeContext.Provider` è un modo legacy per fornire il valore del context prima di React 19.
---
-### `SomeContext` Provider {/*provider*/}
+### Provider di `SomeContext` {/*provider*/}
-Wrap your components into a context provider to specify the value of this context for all components inside:
+Avvolgi i tuoi componenti in un context provider per specificare il valore di questo context per tutti i componenti al suo interno:
```js
function App() {
@@ -64,25 +71,25 @@ function App() {
-Starting in React 19, you can render `` as a provider.
+A partire da React 19, puoi renderizzare `` come provider.
-In older versions of React, use ``.
+Nelle versioni precedenti di React, usa ``.
#### Props {/*provider-props*/}
-* `value`: The value that you want to pass to all the components reading this context inside this provider, no matter how deep. The context value can be of any type. A component calling [`useContext(SomeContext)`](/reference/react/useContext) inside of the provider receives the `value` of the innermost corresponding context provider above it.
+* `value`: Il valore che vuoi passare a tutti i componenti che leggono questo context all'interno di questo provider, indipendentemente dalla profondità. Il valore del context può essere di qualsiasi tipo. Un componente che chiama [`useContext(SomeContext)`](/reference/react/useContext) all'interno del provider riceve il `value` del context provider corrispondente più interno sopra di esso.
---
### `SomeContext.Consumer` {/*consumer*/}
-Before `useContext` existed, there was an older way to read context:
+Prima che esistesse `useContext`, c'era un modo più vecchio per leggere il context:
```js
function Button() {
- // 🟡 Legacy way (not recommended)
+ // 🟡 Modo legacy (sconsigliato)
return (
{theme => (
@@ -93,11 +100,11 @@ function Button() {
}
```
-Although this older way still works, **newly written code should read context with [`useContext()`](/reference/react/useContext) instead:**
+Anche se questo modo più vecchio funziona ancora, **il codice scritto di recente dovrebbe leggere il context con [`useContext()`](/reference/react/useContext) invece:**
```js
function Button() {
- // ✅ Recommended way
+ // ✅ Modo consigliato
const theme = useContext(ThemeContext);
return ;
}
@@ -105,17 +112,17 @@ function Button() {
#### Props {/*consumer-props*/}
-* `children`: A function. React will call the function you pass with the current context value determined by the same algorithm as [`useContext()`](/reference/react/useContext) does, and render the result you return from this function. React will also re-run this function and update the UI whenever the context from the parent components changes.
+* `children`: Una funzione. React chiamerà la funzione che passi con il valore attuale del context determinato dallo stesso algoritmo usato da [`useContext()`](/reference/react/useContext), e renderizzerà il risultato che restituisci da questa funzione. React rieseguirà anche questa funzione e aggiornerà l'UI ogni volta che il context dei componenti genitori cambia.
---
## Usage {/*usage*/}
-### Creating context {/*creating-context*/}
+### Creare un context {/*creating-context*/}
-Context lets components [pass information deep down](/learn/passing-data-deeply-with-context) without explicitly passing props.
+Il context consente ai componenti di [passare informazioni in profondità](/learn/passing-data-deeply-with-context) senza passare esplicitamente le props.
-Call `createContext` outside any components to create one or more contexts.
+Chiama `createContext` al di fuori di qualsiasi componente per creare uno o più context.
```js [[1, 3, "ThemeContext"], [1, 4, "AuthContext"], [3, 3, "'light'"], [3, 4, "null"]]
import { createContext } from 'react';
@@ -124,7 +131,7 @@ const ThemeContext = createContext('light');
const AuthContext = createContext(null);
```
-`createContext` returns a context object. Components can read context by passing it to [`useContext()`](/reference/react/useContext):
+`createContext` restituisce un oggetto context. I componenti possono leggere il context passandolo a [`useContext()`](/reference/react/useContext):
```js [[1, 2, "ThemeContext"], [1, 7, "AuthContext"]]
function Button() {
@@ -138,9 +145,9 @@ function Profile() {
}
```
-By default, the values they receive will be the default values you have specified when creating the contexts. However, by itself this isn't useful because the default values never change.
+Per impostazione predefinita, i valori che ricevono saranno i valori predefiniti che hai specificato quando hai creato i context. Tuttavia, da solo questo non è utile perché i valori predefiniti non cambiano mai.
-Context is useful because you can **provide other, dynamic values from your components:**
+Il context è utile perché puoi **fornire altri valori dinamici dai tuoi componenti:**
```js {8-9,11-12}
function App() {
@@ -159,15 +166,15 @@ function App() {
}
```
-Now the `Page` component and any components inside it, no matter how deep, will "see" the passed context values. If the passed context values change, React will re-render the components reading the context as well.
+Ora il componente `Page` e qualsiasi componente al suo interno, indipendentemente dalla profondità, "vedrà" i valori del context passati. Se i valori del context passati cambiano, React ri-renderizzerà anche i componenti che leggono il context.
-[Read more about reading and providing context and see examples.](/reference/react/useContext)
+[Leggi di più sulla lettura e la fornitura del context e vedi esempi.](/reference/react/useContext)
---
-### Importing and exporting context from a file {/*importing-and-exporting-context-from-a-file*/}
+### Importare ed esportare un context da un file {/*importing-and-exporting-context-from-a-file*/}
-Often, components in different files will need access to the same context. This is why it's common to declare contexts in a separate file. Then you can use the [`export` statement](https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export) to make context available for other files:
+Spesso, componenti in file diversi avranno bisogno di accedere allo stesso context. Per questo è comune dichiarare i context in un file separato. Poi puoi usare l'[istruzione `export`](https://developer.mozilla.org/it/docs/Web/JavaScript/Reference/Statements/export) per mettere il context a disposizione di altri file:
```js {4-5}
// Contexts.js
@@ -177,7 +184,7 @@ export const ThemeContext = createContext('light');
export const AuthContext = createContext(null);
```
-Components declared in other files can then use the [`import`](https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/import) statement to read or provide this context:
+I componenti dichiarati in altri file possono poi usare l'[istruzione `import`](https://developer.mozilla.org/it/docs/Web/JavaScript/Reference/Statements/import) per leggere o fornire questo context:
```js {2}
// Button.js
@@ -205,21 +212,21 @@ function App() {
}
```
-This works similar to [importing and exporting components.](/learn/importing-and-exporting-components)
+Funziona in modo simile a [importare ed esportare componenti.](/learn/importing-and-exporting-components)
---
## Troubleshooting {/*troubleshooting*/}
-### I can't find a way to change the context value {/*i-cant-find-a-way-to-change-the-context-value*/}
+### Non trovo un modo per cambiare il valore del context {/*i-cant-find-a-way-to-change-the-context-value*/}
-Code like this specifies the *default* context value:
+Codice come questo specifica il valore *predefinito* del context:
```js
const ThemeContext = createContext('light');
```
-This value never changes. React only uses this value as a fallback if it can't find a matching provider above.
+Questo valore non cambia mai. React usa questo valore solo come fallback se non trova un provider corrispondente sopra.
-To make context change over time, [add state and wrap components in a context provider.](/reference/react/useContext#updating-data-passed-via-context)
+Per far cambiare il context nel tempo, [aggiungi lo state e avvolgi i componenti in un context provider.](/reference/react/useContext#updating-data-passed-via-context)
diff --git a/src/content/reference/react/forwardRef.md b/src/content/reference/react/forwardRef.md
index db42bfae0..765c2f28a 100644
--- a/src/content/reference/react/forwardRef.md
+++ b/src/content/reference/react/forwardRef.md
@@ -1,18 +1,25 @@
---
title: forwardRef
+translationStatus: ai-draft
---
+
+
+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/reference/react/forwardRef.md).
+
+
+
-In React 19, `forwardRef` is no longer necessary. Pass `ref` as a prop instead.
+In React 19, `forwardRef` non è più necessario. Passa `ref` come prop.
-`forwardRef` will be deprecated in a future release. Learn more [here](/blog/2024/04/25/react-19#ref-as-a-prop).
+`forwardRef` sarà deprecato in una futura release. Scopri di più [qui](/blog/2024/04/25/react-19#ref-as-a-prop).
-`forwardRef` lets your component expose a DOM node to the parent component with a [ref.](/learn/manipulating-the-dom-with-refs)
+`forwardRef` ti permette di esporre un nodo DOM al componente genitore con un [ref.](/learn/manipulating-the-dom-with-refs)
```js
const SomeComponent = forwardRef(render)
@@ -28,7 +35,7 @@ const SomeComponent = forwardRef(render)
### `forwardRef(render)` {/*forwardref*/}
-Call `forwardRef()` to let your component receive a ref and forward it to a child component:
+Chiama `forwardRef()` per far sì che il tuo componente riceva un ref e lo inoltri a un componente figlio:
```js
import { forwardRef } from 'react';
@@ -38,26 +45,26 @@ const MyInput = forwardRef(function MyInput(props, ref) {
});
```
-[See more examples below.](#usage)
+[Vedi altri esempi sotto.](#usage)
#### Parameters {/*parameters*/}
-* `render`: The render function for your component. React calls this function with the props and `ref` that your component received from its parent. The JSX you return will be the output of your component.
+* `render`: La funzione render del tuo componente. React chiama questa funzione con le props e il `ref` che il tuo componente ha ricevuto dal genitore. Il JSX che restituisci sarà l'output del tuo componente.
#### Returns {/*returns*/}
-`forwardRef` returns a React component that you can render in JSX. Unlike React components defined as plain functions, a component returned by `forwardRef` is also able to receive a `ref` prop.
+`forwardRef` restituisce un componente React che puoi renderizzare in JSX. A differenza dei componenti React definiti come funzioni semplici, un componente restituito da `forwardRef` può anche ricevere una prop `ref`.
#### Caveats {/*caveats*/}
-* In Strict Mode, React will **call your render function twice** in order to [help you find accidental impurities.](/reference/react/useState#my-initializer-or-updater-function-runs-twice) This is development-only behavior and does not affect production. If your render function is pure (as it should be), this should not affect the logic of your component. The result from one of the calls will be ignored.
+* In Strict Mode, React **chiamerà la tua funzione render due volte** per [aiutarti a trovare impurità accidentali.](/reference/react/useState#my-initializer-or-updater-function-runs-twice) Questo comportamento vale solo in sviluppo e non influisce sulla produzione. Se la tua funzione render è pura (come dovrebbe essere), non dovrebbe influire sulla logica del tuo componente. Il risultato di una delle chiamate verrà ignorato.
---
-### `render` function {/*render-function*/}
+### Funzione `render` {/*render-function*/}
-`forwardRef` accepts a render function as an argument. React calls this function with `props` and `ref`:
+`forwardRef` accetta una funzione render come argomento. React chiama questa funzione con `props` e `ref`:
```js
const MyInput = forwardRef(function MyInput(props, ref) {
@@ -72,21 +79,21 @@ const MyInput = forwardRef(function MyInput(props, ref) {
#### Parameters {/*render-parameters*/}
-* `props`: The props passed by the parent component.
+* `props`: Le props passate dal componente genitore.
-* `ref`: The `ref` attribute passed by the parent component. The `ref` can be an object or a function. If the parent component has not passed a ref, it will be `null`. You should either pass the `ref` you receive to another component, or pass it to [`useImperativeHandle`.](/reference/react/useImperativeHandle)
+* `ref`: L'attributo `ref` passato dal componente genitore. Il `ref` può essere un oggetto o una funzione. Se il componente genitore non ha passato un ref, sarà `null`. Dovresti inoltrare il `ref` che ricevi a un altro componente oppure passarlo a [`useImperativeHandle`.](/reference/react/useImperativeHandle)
#### Returns {/*render-returns*/}
-`forwardRef` returns a React component that you can render in JSX. Unlike React components defined as plain functions, the component returned by `forwardRef` is able to take a `ref` prop.
+`forwardRef` restituisce un componente React che puoi renderizzare in JSX. A differenza dei componenti React definiti come funzioni semplici, il componente restituito da `forwardRef` può ricevere una prop `ref`.
---
## Usage {/*usage*/}
-### Exposing a DOM node to the parent component {/*exposing-a-dom-node-to-the-parent-component*/}
+### Esporre un nodo DOM al componente genitore {/*exposing-a-dom-node-to-the-parent-component*/}
-By default, each component's DOM nodes are private. However, sometimes it's useful to expose a DOM node to the parent--for example, to allow focusing it. To opt in, wrap your component definition into `forwardRef()`:
+Per impostazione predefinita, i nodi DOM di ogni componente sono privati. A volte però è utile esporre un nodo DOM al genitore — ad esempio, per metterlo a fuoco. Per attivare questa opzione, avvolgi la definizione del componente in `forwardRef()`:
```js {3,11}
import { forwardRef } from 'react';
@@ -102,7 +109,7 @@ const MyInput = forwardRef(function MyInput(props, ref) {
});
```
-You will receive a ref as the second argument after props. Pass it to the DOM node that you want to expose:
+Riceverai un ref come secondo argomento dopo le props. Passalo al nodo DOM che vuoi esporre:
```js {8} [[1, 3, "ref"], [1, 8, "ref", 30]]
import { forwardRef } from 'react';
@@ -118,7 +125,7 @@ const MyInput = forwardRef(function MyInput(props, ref) {
});
```
-This lets the parent `Form` component access the `` DOM node exposed by `MyInput`:
+Questo permette al componente genitore `Form` di accedere al nodo DOM `` esposto da `MyInput`:
```js [[1, 2, "ref"], [1, 10, "ref", 41], [2, 5, "ref.current"]]
function Form() {
@@ -139,15 +146,15 @@ function Form() {
}
```
-This `Form` component [passes a ref](/reference/react/useRef#manipulating-the-dom-with-a-ref) to `MyInput`. The `MyInput` component *forwards* that ref to the `` browser tag. As a result, the `Form` component can access that `` DOM node and call [`focus()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on it.
+Questo componente `Form` [passa un ref](/reference/react/useRef#manipulating-the-dom-with-a-ref) a `MyInput`. Il componente `MyInput` *inoltra* quel ref al tag browser ``. Di conseguenza, il componente `Form` può accedere a quel nodo DOM `` e chiamare [`focus()`](https://developer.mozilla.org/it/docs/Web/API/HTMLElement/focus) su di esso.
-Keep in mind that exposing a ref to the DOM node inside your component makes it harder to change your component's internals later. You will typically expose DOM nodes from reusable low-level components like buttons or text inputs, but you won't do it for application-level components like an avatar or a comment.
+Tieni presente che esporre un ref al nodo DOM interno al tuo componente complica il cambiamento dei dettagli interni in seguito. In genere esporrai nodi DOM da componenti riutilizzabili di basso livello come pulsanti o campi di testo, ma non lo farai per componenti a livello applicativo come un avatar o un commento.
-
+
-#### Focusing a text input {/*focusing-a-text-input*/}
+#### Mettere a fuoco un campo di testo {/*focusing-a-text-input*/}
-Clicking the button will focus the input. The `Form` component defines a ref and passes it to the `MyInput` component. The `MyInput` component forwards that ref to the browser ``. This lets the `Form` component focus the ``.
+Cliccando il pulsante metterai a fuoco l'input. Il componente `Form` definisce un ref e lo passa al componente `MyInput`. Il componente `MyInput` inoltra quel ref al `` del browser. Questo permette al componente `Form` di mettere a fuoco l'``.
@@ -199,9 +206,9 @@ input {
-#### Playing and pausing a video {/*playing-and-pausing-a-video*/}
+#### Riprodurre e mettere in pausa un video {/*playing-and-pausing-a-video*/}
-Clicking the button will call [`play()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play) and [`pause()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/pause) on a `