Snake on a cube with ReactJS