Skip to content

Commit 2b88fd8

Browse files
committed
doc(responding_to_events): translate in french
1 parent de2e000 commit 2b88fd8

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/content/learn/responding-to-events.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
---
2-
title: Responding to Events
2+
title: Réagir aux événements
33
---
44

55
<Intro>
66

7-
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.
7+
React vous permet d’ajouter des *gestionnaires d’événements* à votre JSX. Les gestionnaires d’événements sont vos propres fonctions qui seront déclenchées en réponse aux interactions de l’utilisateur telles que des clics, survols, activations de champs de saisie de formulaires, etc.
88

99
</Intro>
1010

1111
<YouWillLearn>
1212

13-
* Different ways to write an event handler
14-
* How to pass event handling logic from a parent component
15-
* How events propagate and how to stop them
13+
* Différentes façons d’écrire un gestionnaire d’événements
14+
* Comment passer la logique de gestion d’événements depuis un composant parent
15+
* Comment les événements se propagent et comment les arrêter
1616

1717
</YouWillLearn>
1818

19-
## Adding event handlers {/*adding-event-handlers*/}
19+
## Ajouter des gestionnaires d’événements {/*adding-event-handlers*/}
2020

21-
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:
21+
Pour ajouter un gestionnaire d’événements, vous devrez d’abord définir une fonction et [la passer en tant que prop](/learn/passing-props-to-a-component) à la balise JSX appropriée. Par exemple, voici un bouton qui ne fait rien pour le moment :
2222

2323
<Sandpack>
2424

2525
```js
2626
export default function Button() {
2727
return (
2828
<button>
29-
I don't do anything
29+
Je ne fais rien
3030
</button>
3131
);
3232
}
3333
```
3434

3535
</Sandpack>
3636

37-
You can make it show a message when a user clicks by following these three steps:
37+
Vous pouvez faire afficher un message après un clic sur le bouton en suivant ces trois étapes :
3838

39-
1. Declare a function called `handleClick` *inside* your `Button` component.
40-
2. Implement the logic inside that function (use `alert` to show the message).
41-
3. Add `onClick={handleClick}` to the `<button>` JSX.
39+
1. Déclarez une fonction appelée `handleClick` *dans* votre composant `Button`.
40+
2. Implémentez la logique de cette fonction (utilisez `alert` pour afficher le message).
41+
3. Ajoutez `onClick={handleClick}` au `<button>` en JSX.
4242

4343
<Sandpack>
4444

4545
```js
4646
export default function Button() {
4747
function handleClick() {
48-
alert('You clicked me!');
48+
alert('Vous m’avez cliqué !');
4949
}
5050

5151
return (
5252
<button onClick={handleClick}>
53-
Click me
53+
Cliquez-moi
5454
</button>
5555
);
5656
}
@@ -62,30 +62,30 @@ button { margin-right: 10px; }
6262

6363
</Sandpack>
6464

65-
You defined the `handleClick` function and then [passed it as a prop](/learn/passing-props-to-a-component) to `<button>`. `handleClick` is an **event handler.** Event handler functions:
65+
Vous avez défini la fonction `handleClick` puis l'avez [passée en tant que prop](/learn/passing-props-to-a-component) à `<button>`. `handleClick` est un **gestionnaire d'événements**. Les gestionnaires d'événements sont des fonctions qui :
6666

67-
* Are usually defined *inside* your components.
68-
* Have names that start with `handle`, followed by the name of the event.
67+
* Sont généralement définies à l'intérieur de vos composants.
68+
* Ont des noms qui commencent par `handle`, suivi du nom de l'événement.
6969

70-
By convention, it is common to name event handlers as `handle` followed by the event name. You'll often see `onClick={handleClick}`, `onMouseEnter={handleMouseEnter}`, and so on.
70+
Par convention, il est courant de nommer les gestionnaires d'événements en utilisant `handle` suivi du nom de l'événement. Vous verrez souvent `onClick={handleClick}`, `onMouseEnter={handleMouseEnter}`, et ainsi de suite.
7171

72-
Alternatively, you can define an event handler inline in the JSX:
72+
Vous pouvez aussi définir un gestionnaire d'événements en ligne dans le JSX :
7373

7474
```jsx
7575
<button onClick={function handleClick() {
76-
alert('You clicked me!');
76+
alert('Vous m’avez cliqué !');
7777
}}>
7878
```
7979

80-
Or, more concisely, using an arrow function:
80+
Ou vous pouvez être plus concis en utilisant une fonction fléchée :
8181

8282
```jsx
8383
<button onClick={() => {
84-
alert('You clicked me!');
84+
alert('Vous m’avez cliqué !');
8585
}}>
8686
```
8787

88-
All of these styles are equivalent. Inline event handlers are convenient for short functions.
88+
Tous ces styles sont équivalents. Les gestionnaires d'événements en ligne sont pratiques pour les fonctions courtes.
8989

9090
<Pitfall>
9191

0 commit comments

Comments
 (0)