0.5.1 • Published 8 years ago

react-results-proptypes v0.5.1

Weekly downloads
2
License
WTFPL
Repository
github
Last release
8 years ago

Results PropTypes for React

Build Status

$ npm install react-results-proptypes
import { unionOf, maybeOf } from 'react-results-proptypes';

// this would be declared somewhere else in the app and imported
const MyUnion = Union({ A: null, B: null, C: null });

const MyComponent = React.createClass({
  propTypes: {
    maybeAString: maybeOf(React.PropTypes.string),
    thingFromMyUnion: unionOf(MyUnion, {
      A: React.PropTypes.string,
      B: React.PropTypes.number,
      C: null,
    }),
  },
  ...
});

The component above would pass checks if:

  • maybeAString were Maybe.None() or Maybe.Some('string')
  • thingFromMyUnion were any of
    • MyUnion.A('blah'),
    • MyUnion.B(42),
    • MyUnion.C()
0.5.1

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago