Created
February 11, 2022 09:11
-
-
Save smgrv123/ca8ac47c8cefed07239d772082852464 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { useState, useEffect } from 'react'; | |
const useDocumentTitle = (title) => { | |
useEffect(() => { | |
console.log(title) | |
}, [title]) | |
} | |
export default App = () => { | |
const [count, setCount] = useState(0); | |
const incrementCount = () => setCount(count + 1); | |
useDocumentTitle(count) | |
return ( | |
<div> | |
<p>You clicked {count} times</p> | |
<button onClick={incrementCount}>ClickMe</button> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment