skip to Main Content

ReactJS-setInterval not working as expected

import React,{useState} from "react"; import {Dialog,DialogTitle,DialogContent,DialogActions,Button} from "@mui/material"; const SessionTimeoutDialog=()=> { let b; let [intervalStopCount,setIntervalStopCount]=useState(0); let [a,setA]=useState(0); const [o,setO]=useState(false); function print5(){console.log("Testing print5 function");} const print7=(e)=> { console.log(e); e.preventDefault(); console.log("Testing print7 function"); } const stop=(e)=> { setIntervalStopCount(++intervalStopCount); setO(!o); clearInterval(b); console.log("intervalStopCount",intervalStopCount+" "+o);…

VIEW QUESTION
Back To Top
Search