From d50f4ea1036ba77bd288cb2c5aa8268fcb02e734 Mon Sep 17 00:00:00 2001 From: Th3Wall Date: Tue, 2 May 2023 14:51:42 +0200 Subject: [PATCH 1/2] Translated Responding to Events page & related sidebar label --- src/content/learn/responding-to-events.md | 211 +++++++++++----------- src/sidebarLearn.json | 2 +- 2 files changed, 106 insertions(+), 107 deletions(-) diff --git a/src/content/learn/responding-to-events.md b/src/content/learn/responding-to-events.md index 782b6c0f1..b02f3915d 100644 --- a/src/content/learn/responding-to-events.md +++ b/src/content/learn/responding-to-events.md @@ -1,24 +1,24 @@ --- -title: Responding to Events +title: Rispondere agli Eventi --- -React lets you add *event handlers* to your JSX. Event handlers are your own functions that will be triggered in response to interactions like clicking, hovering, focusing form inputs, and so on. +React ti permette di aggiungere dei *gestori di eventi* al tuo JSX. I gestori di eventi sono funzioni scritte da te che verranno attivate in risposta ad interazioni come il click, il passaggio del mouse, il focus sugli input dei form, e così via. -* Different ways to write an event handler -* How to pass event handling logic from a parent component -* How events propagate and how to stop them +* Modi differenti per scrivere un gestore di eventi +* Come passare la logica di gestione degli eventi da un componente genitore +* Come si propagano gli eventi e come fermarli -## Adding event handlers {/*adding-event-handlers*/} +## Aggiungere gestori di eventi {/*adding-event-handlers*/} -To add an event handler, you will first define a function and then [pass it as a prop](/learn/passing-props-to-a-component) to the appropriate JSX tag. For example, here is a button that doesn't do anything yet: +Per aggiungere un gestore di eventi, dovrai prima definire una funzione e poi [passarla come prop](/learn/passing-props-to-a-component) al tag JSX appropriato. Ad esempio, ecco un bottone che per il momento non fa nulla: @@ -34,11 +34,11 @@ export default function Button() { -You can make it show a message when a user clicks by following these three steps: +Puoi fargli mostrare un messaggio quando un utente clicca seguendo questi tre passaggi: -1. Declare a function called `handleClick` *inside* your `Button` component. -2. Implement the logic inside that function (use `alert` to show the message). -3. Add `onClick={handleClick}` to the `