MCPcopy Create free account
hub / github.com/coolvasanth/reactjs_interview_preparation / Exercise6

Function Exercise6

src/HardQuestions/Exercise6.js:3–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import React, { useState } from 'react';
2
3function Exercise6() {
4 const [count, setCount] = useState(0);
5
6 const handleClick = () => {
7 setCount(count + 1);
8 setTimeout(() => {
9 alert(count);
10 }, 3000);
11 };
12
13 return (
14 <div>
15 <button onClick={handleClick}>Click Me</button>
16 <h1>{count}</h1>
17 </div>
18 );
19}
20
21export default Exercise6;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected