Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. const BasicEffect = () => {
  2. const [age, setAge] = useState(0)
  3. const handleClick = () => setAge(age + 1)
  4.  
  5. useEffect(() => {
  6. document.title = 'You are ' + age + ' years old!'
  7. })
  8.  
  9. return <div>
  10. <p> Look at the title of the current tab in your browser </p>
  11. <button onClick={handleClick}>Update Title!! </button>
  12. </div>
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement