Basically I want to animate with gsap in react on enter/exit of an element , there seems to be no way to do this without complex hacks, I'm new to react animations and GSAP, can anyone please help atleast guide me where to look, Basically I have a input element and a button , when the button is clicked the input should smoothly vanish and then get unmounted based on button state, I need help in enter/exit of elements. This is my code:
class LoginBox extends React.Component {
constructor(props) {
super(props);
this.myElement = null;
}
componentWillLeave(callback) {
gsap.to(this.myElement, 6, {opacity: 0, onComplete: callback});
}
render(){
return(
<form>
{
this.props.loginButton.isSelected && <input ref={input => this.myElement = input} type="text" placeholder="Enter email address"/>
}
)
}