Hi Rodrigo,
Thanks for the reply! Haha, I wouldn't want our lord and saviour Dan Abramov to suffer a stroke ?
Sorry for not being clear, i want to have a component that displays a number value that is animated up or down whenever the value changes. My actual use case is for a pricing calculator, whereby the price will animate up and down whenever a user changes parameters on other components. So yes the object values are related to the component's state, the object is merely there so GSAP can tween the value between the previous state and current state.
Does that make sense?
I'd done this before when i was working with JQuery & GSAP, i used a similar technique of having an object in a closure that GSAP would tween the value of and then apply the value on each update to the DOM element. Same technique as the below thread.
So that's what i thought would be easiest to use again, although yes it's not the React way of doing things. As now GSAP is in control of the rendered value.
I'm also not sure how you'd get GSAP to tween a React hook state value, as i thought we shouldn't ever mutate the state value directly, so would need GSAP to call a setter method.
Thanks again for helping me out! Hope i'm not being confusing.