component.js
needs to be rendered in a <ReactTransitionGroup />
component.
If the component is connected to Redux, then you need a special connect function that recognizes the
componentWillAppear
, componentDidAppear
, componentWillEnter
, componentDidEnter
,
componentWillLeave
and componentDidLeave
.
This is because the normal connect
function swallows your original component, so it hides those lifecycle functions
unless you explicitly write a new version of connect that looks for them! Example component below (soon)!
Make sure that renderPosition
does not do anything with React. You only want to manipulate the direct DOM. If you were
to try and put the styles in state, either component level or Redux level, it would would be really expensive!
TODO - Make notes about the connect function that allows you to use spring animations based on direct state changes! Something like animating a button to scale when pressed!. This is only if you want to allow the animation to be called from outside the component!