I want to animate multiple steps within a form with react-spring
. This is what I have so far.
import React, { useState} from 'react';
import { animated, useSpring } from 'react-spring';
const AnimatedContainer = animated.div
function MultiStepForm() {
const [step, setStep] = useState(1);
const style = useSpring({
to: {opacity: 1},
from: {opacity: 0},
config: {
duration: 200
}
})
return (
<AnimatedContainer style={style}>
{...conditional rendering based on step state}
</AnimatedContainer>
)
}
I read the docs several times and I still cannot figure how to do this. I was previously using react-transition group
and it was very easy with it, but for this project I have to use react-spring
. I would appreciate any kind of help as I am stuck right now.