()
| 1 | import React, { useState } from 'react'; |
| 2 | |
| 3 | function Exercise5() { |
| 4 | const [state, setState] = useState({ count: 0 }); |
| 5 | |
| 6 | const incrementCount = () => { |
| 7 | setState(prevState => ({ |
| 8 | count: prevState.count + 1 |
| 9 | })); |
| 10 | setState(prevState => ({ |
| 11 | count: prevState.count + 1 |
| 12 | })); |
| 13 | }; |
| 14 | |
| 15 | return ( |
| 16 | <div> |
| 17 | <button onClick={incrementCount}>Increment</button> |
| 18 | <h1>{state.count}</h1> |
| 19 | </div> |
| 20 | ); |
| 21 | } |
| 22 | |
| 23 | export default Exercise5; |
nothing calls this directly
no outgoing calls
no test coverage detected