Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
React hooks useState example
export const UseState = () => {
//Declare state value of count and setCount function to update
//set the initial value of count as 0
const [count, setCount] = useState(0);
//setCount function
return (
<div className='content'>
<p>You clicked {count} times</p>
onClick={() => setCount(count + 1)}>
Click me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.