Update react state every second

I’m trying to make a sorting algorithm visualizer, and i’m stuck on rendering the new state each second.

I want to update the view after each step to show the be haviour of each algorithm.

This sandbox describes my problem.

Can anyone tell me what I’m missing.