JSPM

react-extra-prop-types

0.3.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2527
  • Score
    100M100P100Q114179F
  • License MIT

Extra PropTypes for use with React components

Package Exports

  • react-extra-prop-types

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-extra-prop-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-extra-prop-types

Includes some additional React PropTypes for common use cases. No dependencies.

NPM

PropTypes

  • integer - invalid if prop is non-integer
  • color - invalid if prop is not valid CSS color string (rgb(a), hsl(a), hex). Excludes keywords.
  • datetime - invalid if prop is not string which can be passed to JavaScript Date constructor with valid result
  • uuid - invalid if prop is not valid UUID

Usage

require-ing

var ExtraPropTypes = require('react-extra-prop-types');
var color = ExtraPropTypes.color;
var uuid = ExtraPropTypes.uuid;

// or ...
var color = require('react-extra-prop-types/lib/color');
var uuid = require('react-extra-prop-types/lib/uuid');

use just like normal PropTypes

MyReactComponent.propTypes = {
  id: ExtraPropTypes.integer,
  name: React.PropTypes.string,
  lastFetchTime: ExtraPropTypes.datetime
};

props are optional unless .isRequired is used

MyReactComponent.propTypes = {
  id: ExtraPropTypes.integer.isRequired // can't be left out
};

Development

See CONTRIBUTING.md.