react-extra-prop-types
Includes some additional React PropTypes for common use cases. No dependencies.
PropTypes
integer
- invalid if prop is non-integercolor
- 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 JavaScriptDate
constructor with valid resultuuid
- invalid if prop is not valid UUID
Usage
require
-ing
var ExtraPropTypes = ;var color = ExtraPropTypescolor;var uuid = ExtraPropTypesuuid; // or ...var color = ;var uuid = ;
PropTypes
use just like normal MyReactComponentpropTypes = id: ExtraPropTypesinteger name: ReactPropTypesstring lastFetchTime: ExtraPropTypesdatetime;
.isRequired
is used
props are optional unless MyReactComponentpropTypes = id: ExtraPropTypesintegerisRequired // can't be left out;
Development
See CONTRIBUTING.md.