Changing material color is not working without useEffect in react three fiber

I’m trying to change material color traversing the scene but its not working. But when I change the color consoling that material in browser it is working. I’m using this code


needs context. if you load stuff async the scene is empty, or when you’re running before it was filled it’s empty as well. normally you should never have side effects anywhere, that’s what useEffect is there for, it makes sure everything is in its place.