SHARE
TWEET

Untitled

a guest Oct 17th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, {useState} from 'react'
  2.  
  3. function Counter() {
  4.   const [counter, incrementCounter] = useState(0)
  5.  
  6.   function handleIncrement() {
  7.     incrementCounter(counter + 1)
  8.   }
  9.  
  10.   return (
  11.     <div>
  12.       <div>{counter}</div>
  13.       <hr />
  14.       <button type="button" onClick={handleIncrement}>+</button>
  15.     </div>
  16.   )
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top