counter composant react

Solutions on MaxInterview for counter composant react by the best coders in the world

showing results for - "counter composant react"
Milan
31 Sep 2019
1import React, { useState } from 'react';
2
3function Example() {
4  // Déclare une nouvelle variable d'état, que l'on va appeler « count »  const [count, setCount] = useState(0);
5  return (
6    <div>
7      <p>Vous avez cliqué {count} fois</p>
8      <button onClick={() => setCount(count + 1)}>
9        Cliquez ici
10      </button>
11    </div>
12  );
13}