Estoy tratando de hacer el juego de la vida con reaccionar, pero solo estoy renderizando una vez en lugar de varias veces como se suponía. Inside handleGame tiene un setGrid que es lo que solo funciona una vez.
const handleRules = (neighbors, grid, i, j) => { const next = [...grid]; switch (true) { case neighbors > 3: next[i][j] = 0; break; case neighbors < 2: next[i][j] = 0; break; default: next[i][j] = 1; } return next; }; const handleGame = () => { for (let row = 0; row < initialRows; row++) { for (let col = 0; col < initialCols; col++) { // let current = gridCopy[row][col]; let next; if ( row === 0 || col === 0 || row === initialRows - 1 || col === initialCols - 1 ) { /* setGrid((current) => { next[row][col] = grid[row][col]; return [...next]; }); */ } else { setGrid((current) => { const neighbors = handleCountNeighbors(current, row, col); next = handleRules(neighbors, current, row, col); return [...next]; }); } } } }; const handleStart = () => { for (let i = 0; i <= gen; i++) { handleGame(); } };¿Alguien me puede ayudar? https://codesandbox.io/s/tender-snow-gcknd?file=/src/App.js