Last active
July 6, 2021 05:59
-
-
Save manoj-mass/1919775da5daa6e5a3852abbbb7f91de to your computer and use it in GitHub Desktop.
Simple counter component - https://medium.com/@manojdarshana/reactjs-testing-with-jest-81bb17dd6c65
This file contains hidden or 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 { 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