Skip to content

Instantly share code, notes, and snippets.

@manoj-mass
Last active July 6, 2021 05:59
Show Gist options
  • Save manoj-mass/1919775da5daa6e5a3852abbbb7f91de to your computer and use it in GitHub Desktop.
Save manoj-mass/1919775da5daa6e5a3852abbbb7f91de to your computer and use it in GitHub Desktop.
import { useState } from 'react';
function Counter() {
const [count , setCount] = useState(0);
return (
<>
<div className="counter">
<h1>Current count is - <label data-testid={"counterID"}>{count}</label></h1>
<button onClick={e => setCount(count + 1)}>Increment</button>
</div>
</>
);
}
export default Counter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment