I'm working on the simple timer app in the React. Below is the code of what I have.
import React from "react"
const timer = (props) => {
let time = 25;
let processStatus = props.timerProcessStatus; // it comes as true
if(processStatus === true) {
setTimeout(() => {
console.log(proccessStatus);
countDown();
}, 500)
}
function countDown(){
time=time-1;
console.log(time);
}
return (
<div>
<p id={props.statusId}>{props.timerStatus}</p>
<p id={props.timerStatusId}>{time}:00</p>
</div>
)
}
export default timer;
And here is the snapshot of what I get in the browser

As it shows, the time variable changed to 24 (although I would expect it to decrease to 23 second time), it doesn't re-renders in the paragraph, where the content is {time}:00