Skip to content

Commit 0cbe069

Browse files
deblasiscursoragent
andcommitted
translate(reference): startTransition
Signed-off-by: Alessandro De Blasis <alex@deblasis.net> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 1fa3fbd commit 0cbe069

1 file changed

Lines changed: 25 additions & 18 deletions

File tree

‎src/content/reference/react/startTransition.md‎

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
---
22
title: startTransition
3+
translationStatus: ai-draft
34
---
45

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/reference/react/startTransition.md).
9+
10+
</Note>
11+
512
<Intro>
613

7-
`startTransition` lets you render a part of the UI in the background.
14+
`startTransition` ti permette di renderizzare una parte dell'UI in background.
815

916
```js
1017
startTransition(action)
@@ -20,7 +27,7 @@ startTransition(action)
2027

2128
### `startTransition(action)` {/*starttransition*/}
2229

23-
The `startTransition` function lets you mark a state update as a Transition.
30+
La funzione `startTransition` ti permette di contrassegnare un aggiornamento di state come una Transizione.
2431

2532
```js {7,9}
2633
import { startTransition } from 'react';
@@ -37,39 +44,39 @@ function TabContainer() {
3744
}
3845
```
3946

40-
[See more examples below.](#usage)
47+
[Vedi altri esempi sotto.](#usage)
4148

4249
#### Parameters {/*parameters*/}
4350

44-
* `action`: A function that updates some state by calling one or more [`set` functions](/reference/react/useState#setstate). React calls `action` immediately with no parameters and marks all state updates scheduled synchronously during the `action` function call as Transitions. Any async calls awaited in the `action` will be included in the transition, but currently require wrapping any `set` functions after the `await` in an additional `startTransition` (see [Troubleshooting](/reference/react/useTransition#react-doesnt-treat-my-state-update-after-await-as-a-transition)). State updates marked as Transitions will be [non-blocking](#marking-a-state-update-as-a-non-blocking-transition) and [will not display unwanted loading indicators.](/reference/react/useTransition#preventing-unwanted-loading-indicators).
51+
* `action`: Una funzione che aggiorna dello state chiamando una o più [`set` functions](/reference/react/useState#setstate). React chiama `action` immediatamente senza parametri e contrassegna come Transizioni tutti gli aggiornamenti di state pianificati in modo sincrono durante la chiamata alla funzione `action`. Qualsiasi chiamata async attesa con `await` in `action` sarà inclusa nella Transizione, ma attualmente richiede di avvolgere qualsiasi `set` function dopo `await` in un ulteriore `startTransition` (vedi [Troubleshooting](/reference/react/useTransition#react-doesnt-treat-my-state-update-after-await-as-a-transition)). Gli aggiornamenti di state contrassegnati come Transizioni saranno [non bloccanti](#marking-a-state-update-as-a-non-blocking-transition) e [non mostreranno indicatori di caricamento indesiderati.](/reference/react/useTransition#preventing-unwanted-loading-indicators)
4552

4653
#### Returns {/*returns*/}
4754

48-
`startTransition` does not return anything.
55+
`startTransition` non restituisce nulla.
4956

5057
#### Caveats {/*caveats*/}
5158

52-
* `startTransition` does not provide a way to track whether a Transition is pending. To show a pending indicator while the Transition is ongoing, you need [`useTransition`](/reference/react/useTransition) instead.
59+
* `startTransition` non fornisce un modo per tracciare se una Transizione è in corso. Per mostrare un indicatore di pending mentre la Transizione è in corso, hai bisogno di [`useTransition`](/reference/react/useTransition) al suo posto.
5360

54-
* You can wrap an update into a Transition only if you have access to the `set` function of that state. If you want to start a Transition in response to some prop or a custom Hook return value, try [`useDeferredValue`](/reference/react/useDeferredValue) instead.
61+
* Puoi avvolgere un aggiornamento in una Transizione solo se hai accesso alla `set` function di quello state. Se vuoi avviare una Transizione in risposta a una prop o a un valore di un custom Hook, prova [`useDeferredValue`](/reference/react/useDeferredValue).
5562

56-
* The function you pass to `startTransition` is called immediately, marking all state updates that happen while it executes as Transitions. If you try to perform state updates in a `setTimeout`, for example, they won't be marked as Transitions.
63+
* La funzione che passi a `startTransition` viene chiamata immediatamente, contrassegnando come Transizioni tutti gli aggiornamenti di state che avvengono mentre viene eseguita. Se provi a eseguire aggiornamenti di state in un `setTimeout`, per esempio, non saranno contrassegnati come Transizioni.
5764

58-
* You must wrap any state updates after any async requests in another `startTransition` to mark them as Transitions. This is a known limitation that we will fix in the future (see [Troubleshooting](/reference/react/useTransition#react-doesnt-treat-my-state-update-after-await-as-a-transition)).
65+
* Devi avvolgere qualsiasi aggiornamento di state dopo richieste async in un altro `startTransition` per contrassegnarli come Transizioni. Questa è una limitazione nota che correggeremo in futuro (vedi [Troubleshooting](/reference/react/useTransition#react-doesnt-treat-my-state-update-after-await-as-a-transition)).
5966

60-
* A state update marked as a Transition will be interrupted by other state updates. For example, if you update a chart component inside a Transition, but then start typing into an input while the chart is in the middle of a re-render, React will restart the rendering work on the chart component after handling the input state update.
67+
* Un aggiornamento di state contrassegnato come Transizione verrà interrotto da altri aggiornamenti di state. Per esempio, se aggiorni un componente grafico all'interno di una Transizione, ma poi inizi a digitare in un input mentre il grafico è nel mezzo di una ri-renderizzazione, React riavvierà il lavoro di renderizzazione sul componente grafico dopo aver gestito l'aggiornamento dell'input.
6168

62-
* Transition updates can't be used to control text inputs.
69+
* Gli aggiornamenti Transizione non possono essere usati per controllare input di testo.
6370

64-
* If there are multiple ongoing Transitions, React currently batches them together. This is a limitation that may be removed in a future release.
71+
* Se ci sono più Transizioni in corso, React attualmente le raggruppa insieme. Questa è una limitazione che potrebbe essere rimossa in una release futura.
6572

6673
---
6774

6875
## Usage {/*usage*/}
6976

70-
### Marking a state update as a non-blocking Transition {/*marking-a-state-update-as-a-non-blocking-transition*/}
77+
### Contrassegnare un aggiornamento di state come Transizione non bloccante {/*marking-a-state-update-as-a-non-blocking-transition*/}
7178

72-
You can mark a state update as a *Transition* by wrapping it in a `startTransition` call:
79+
Puoi contrassegnare un aggiornamento di state come una *Transizione* avvolgendolo in una chiamata a `startTransition`:
7380

7481
```js {7,9}
7582
import { startTransition } from 'react';
@@ -86,14 +93,14 @@ function TabContainer() {
8693
}
8794
```
8895

89-
Transitions let you keep the user interface updates responsive even on slow devices.
96+
Le Transizioni ti permettono di mantenere reattivi gli aggiornamenti dell'interfaccia utente anche su dispositivi lenti.
9097

91-
With a Transition, your UI stays responsive in the middle of a re-render. For example, if the user clicks a tab but then change their mind and click another tab, they can do that without waiting for the first re-render to finish.
98+
Con una Transizione, la tua UI resta reattiva nel mezzo di una ri-renderizzazione. Per esempio, se l'utente clicca una tab ma poi cambia idea e clicca un'altra tab, può farlo senza attendere che la prima ri-renderizzazione sia completata.
9299

93100
<Note>
94101

95-
`startTransition` is very similar to [`useTransition`](/reference/react/useTransition), except that it does not provide the `isPending` flag to track whether a Transition is ongoing. The standalone function is also not associated with a component, so if the function passed to it throws an error or returns a rejected Promise, React reports the error with [`reportError`](https://developer.mozilla.org/en-US/docs/Web/API/Window/reportError). You can call `startTransition` when `useTransition` is not available. For example, `startTransition` works outside components, such as from a data library.
102+
`startTransition` è molto simile a [`useTransition`](/reference/react/useTransition), tranne per il fatto che non fornisce il flag `isPending` per tracciare se una Transizione è in corso. La funzione standalone non è inoltre associata a un componente, quindi se la funzione passata lancia un errore o restituisce una Promise rifiutata, React segnala l'errore con [`reportError`](https://developer.mozilla.org/it/docs/Web/API/Window/reportError). Puoi chiamare `startTransition` quando `useTransition` non è disponibile. Per esempio, `startTransition` funziona fuori dai componenti, ad esempio da una libreria dati.
96103

97-
[Learn about Transitions and see examples on the `useTransition` page.](/reference/react/useTransition)
104+
[Scopri di più sulle Transizioni e vedi esempi nella pagina `useTransition`.](/reference/react/useTransition)
98105

99106
</Note>

0 commit comments

Comments
 (0)