Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement