I am trying to make a Conway’s Game of Life animation… Managed to set everything up but can’t get setInterval
to work right in React.
Right now the setInterval
chunk is wrapped in a useEffect
hook with no dependencies in the array. So, it changes only once. OK.
But when I add matrix
(the actual state that would change every interval) to the array, it works well for 2-3 ticks then the rects weirdly disappear and reappear many times in milliseconds. I have no idea what causes that.
Any help?