React | Animation And Transitions | Question 8

Last Updated :
Discuss
Comments

Which React Spring hook is used to animate a single value?

JavaScript
const [style, api] = useTransition(true, {
  from: { opacity: 0 },
  enter: { opacity: 1 },
  leave: { opacity: 0 },
});

return <animated.div style={style}>I will fade in</animated.div>;

useState

useSpring

useTransition

useEffect

Share your thoughts in the comments