noximus
11/7/2018 - 12:26 AM

GSAP & React StaggerTo

Stagger to and React App

constructor(props){
  super(props);
  this.myTween = new TimelineLite({paused: true});
  this.myElements = [];
}

componentDidMount(){
  this.myTween.staggerTo(this.myElements, 0.5, {y: 0, autoAlpha: 1}, 0.1);
}

render(){
  return <div>
    <ul>
      {elementsArray.map((element, index) => <li
        key={element.id}
        ref={li => this.myElements[index] = li}
      >
        {element.name}
      </li>)}
    </ul>
  </div>;
}