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

Function Exercise1

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

Source from the content-addressed store, hash-verified

1import React, { useState, useEffect } from 'react';
2
3function Exercise1() {
4 const [count, setCount] = useState(0);
5
6 useEffect(() => {
7 setCount(count + 1);
8 }, []);
9
10 useEffect(() => {
11 setCount(count + 2);
12 }, []);
13
14 return <h1>{count}</h1>;
15}
16
17export default Exercise1;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected