i am running a for loop in which it iterates the value of i till 100000 , what i did is used a for loop and inside that used a setstate and i called the state variable in html jsx. Results are getting but the variable changes from 0 to 100000 after some wait.. i want to display the state like 0,1,2,3,4...100000 on very fast manner how can i do that..
code
const [timer, settimer] = useState(0);
for (let i = 0; i < 100000; i++) {
settimer(i)
}
return <h1>{timer}</h1>
as i told i need live updation of the variable, How can i achieve this with reactjs javascript