Hi,
The problem is not related to Redux or state management, but in the order of operations.
In React the component tree is rendered from the farthest child up to the main root component, so when you have this in your main app:
<div className='w-full min-h-svh flex flex-col items-center justify-center bg-zinc-900'>
<Box1 />
</div>
And this in your Box1 component:
<div ref={container}>
<div className='red-box w-40 h-40 bg-red-500 mb-10'></div>
<Box2 />
</div>
Box2 is rendered first and that particular instance is added to the timeline, then Box1 is rendered and that animation is added to the timeline, so the timeline plays the elements in the right order.
In order to make this work the way you want your app file should have both Box components in the order you want the animations to happen:
<div className='w-full min-h-svh flex flex-col items-center justify-center bg-zinc-900'>
<Box1 />
<Box2 />
</div>
That seems to work the way you intend.
Hopefully this helps
Happy Tweening!