Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created August 2, 2021 15:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BetterProgramming/f035c0e480fe327f93c732f55996b42c to your computer and use it in GitHub Desktop.
Save BetterProgramming/f035c0e480fe327f93c732f55996b42c to your computer and use it in GitHub Desktop.
import React, { useState } from 'react';
function Counter() {
// Declare count variable
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment