I have a div with 10 elements, which are to be updated one-by-one with a time delay of say 2secs. Below is the code for the same
for(let boxNo=0; boxNo<10; bo
This works for fine for me.
(function loop (boxNo) { setTimeout(function () { nodes[boxNo].isMarked = true; this.setState({nodes}); if (--boxNo) loop(boxNo); // decrementing i and calling loop function again if i > 0 }, ((boxNo+1)*2000)+boxNo) })(10);