Your useEffect is your issues. Its dependencies are shared values, but those won’t trigger the effect to run since their shallow equality stays the same across renders (like refs!). Try making your index a state value.