Well @Sahil is spot on (that's why He is a superstar around here ).
The only thing I'd change is using the ref callback instead of reaching to the DOM directly. So instead of this:
componentDidMount(){
const loaderContainer = document.querySelector("#loader-container");
const loader = document.querySelector("#loader");
this.tl
.to(loader, 1, { y: -250, delay: 0.3 })
.to(loaderContainer, 0.2, { alpha: 0, display: "none" };
}
I would create a reference in the constructor:
constructor(props){
super(props);
this.loaderContainer = null;
this.loader = null;
}
Then in the render method use the ref callback:
render(){
return <div>
<div ref={ e => this.loaderContainer = e }>
<div ref={ e => this.loader = e }>
</div>
</div
</div>;
}
Finally in the component did mount method:
componentDidMount(){
this.tl
.to(this.loader, 1, { y: -250, delay: 0.3 })
.to(this.loaderContainer, 0.2, { alpha: 0, display: "none" };
}
But beyond that small detail just do what @Sahil is doing and you'll be fine.
Happy Tweening!!