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

Function Exercise8

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

Source from the content-addressed store, hash-verified

1import React, { useState, useEffect } from 'react';
2
3function Exercise8() {
4 const [value, setValue] = useState(0);
5
6 useEffect(() => {
7 const timer = setInterval(() => {
8 console.log('value is', value);
9 setValue(value + 1);
10 }, 1000);
11
12 return () => clearInterval(timer);
13 }, []);
14
15 return <h1>{value}</h1>;
16}
17
18export default Exercise8;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected