azazdeaz / react-gsap-enhancer

Use the full power of React and GSAP together
MIT License
727 stars 38 forks source link

Any way to use as an ES6 super class? #26

Open guncha opened 8 years ago

guncha commented 8 years ago

The library would be much easier to use with Typescript if it was possible to use it as a super class. E.g.,

import {GSAPComponent} from "react-gsap-enhancer"

class MyComponent extends GSAPComponent {
  componentDidMount(prevProps, prevState) {
    super.componentDidMount(prevProps, prevState)
    this.myController = this.addAnimation(...)
  }
  render() {
    // I understand that the enhancer render function needs to add refs, so
    // perhaps the API can be something like this:
    super.render(() => {
      // the usual render function business..
      return <div... />
    })
  }
}