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

Function Exercise2

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

Source from the content-addressed store, hash-verified

1import React, { useState } from 'react';
2
3function Exercise2() {
4 const [text, setText] = useState("Hello");
5
6 const handleClick = () => {
7 setText(text + " World");
8 setText("React");
9 };
10
11 return (
12 <div>
13 <button onClick={handleClick}>Click Me</button>
14 <h1>{text}</h1>
15 </div>
16 );
17}
18
19export default Exercise2;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected