Skip to content

Instantly share code, notes, and snippets.

@prdxs
Last active March 24, 2021 19:12
Show Gist options
  • Save prdxs/14a9921a5ca1ffe3f1ce27a6547d0572 to your computer and use it in GitHub Desktop.
Save prdxs/14a9921a5ca1ffe3f1ce27a6547d0572 to your computer and use it in GitHub Desktop.
function ClicksButton({ className, style }) {
const [clicks, setClicks] = useState(0);
const handleClick = useCallback(() => setClicks((clicks) => clicks + 1), []);
return (
<button
className={clsx('ClicksButton', className)}
style={style}
onClick={handleClick}
>
Clicks {clicks}
</button>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment