azazdeaz / react-gsap-enhancer

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

redux 'connect' and GSAP #42

Closed juanzone closed 7 years ago

juanzone commented 7 years ago

Hello,

How can I use react-gsap-enhancer with redux in my react component? When i export my class with 'connect' for redux how can I put GSAP?

exemple: 'export default connect(mapStateToProps, mapDispatchToProps)(Component)'

Thanks :)

benstepp commented 7 years ago

When using multiple higher order components we use the compose helper from redux where I work.

import { compose } from 'redux'

export default compose(
  connect(mapStateToProps, mapDispatchToProps),
  GSAP(),
)(MyComponent)

You could also just do the composing manually instead

export default connect(mapStateToProps, mapDispatchToProps)(GSAP()(MyComponent))
juanzone commented 7 years ago

Thanks for the help mate! I'll use the compose helper ;)