Skip to content

v1.0.5

Compare
Choose a tag to compare
@joshwcomeau joshwcomeau released this 11 Feb 14:10
· 283 commits to master since this release

Implement higher-order component for prop preparation.

Refactored FlipMove so that all prop-related logic (and there's a lot of it, with this module) lives in a higher-order component. This logic is crucial, but very uninteresting. By moving it out of the core component, the logic of the component becomes much cleaner and easy to reason about.

It also improves the performance of the module; because props are immutable within a component, the type conversion needed to happen several times, in different lifecycle components. React.Children.toArray was being called 3 times; now it's being called once.

Full list of changes:

  • duration, delay, staggerDurationBy, and staggerDelayBy can either be numbers or strings. The higher-order component converts them to integers, and warns if an invalid value was provided.
  • Converted single children to an array, so that they could be iterated over.
  • Moved propTypes and defaultProps to the new higher-order component.