Skip to content

Remove unnecessary state

Compare
Choose a tag to compare
@roderickhsiao roderickhsiao released this 28 Feb 08:11
5149b0d

#10

  1. Remove unused React state
    We are not using the state at all, the state is exactly the same as props.
    Will be able remove the dependency of react-lifecycles-compat.
  2. Start to support new version of React
    We have componentDidUpdate to write css property as React doesn't support it until 15.6.
    To prevent breaking changes, I just simply made it a named export, so if you are using a new version of React, you could do import { AspectRatio } from 'react-aspect-ratio'; which is much simpler
  3. Remove extends from PureComponent
    The component takes children props, which will be different on each render already, extending from PureComponent doesn't have much performance benefit in this case.