showing results for - "counter app using hooks in react"
Pedro
06 Nov 2019
1//How to make a a counter app with hooks in react. 
2
3import React, { useState } from 'react';
4function Example() {
5  // Declare a new state variable, which we'll call "count"  const [count, setCount] = useState(0);
6  return (
7    <div>
8      <p>You clicked {count} times</p>
9      <button onClick={() => setCount(count + 1)}>
10        Click me
11      </button>
12    </div>
13  );
14}