Migration from version 1
react-gsap
version 2 is mostly backwards compatible with version 1.
But there are 2 changes:
You need to install
gsap
separately. So if you upgradereact-gsap
you need to upgradegsap
to a version >= 3.The
Tween
component propsstaggerFrom
andstaggerTo
are removed. Ingsap
version >=3 you can "stagger" the normal gsap.to(), gsap.from() and gsap.fromTo() functions.
So replace this:
<Tween staggerTo={{ x: '200px' }} stagger={0.2}><div style={{ width: '20px', height: '20px', background: '#ccc' }} /><div style={{ width: '20px', height: '20px', background: '#ccc' }} /></Tween>
With this:
<Tween to={{ x: '200px' }} stagger={0.2}><div style={{ width: '20px', height: '20px', background: '#ccc' }} /><div style={{ width: '20px', height: '20px', background: '#ccc' }} /></Tween>
There are possible more changes in gsap
version 3 that leads to a different behaviour. Have also a look at https://greensock.com/3-migration/.
If you find something please open an issue in github.