@ncodefactory/prop-types-custom
v1.0.0
Published
quick and easy creation custom prop types validators for react props
Downloads
2
Readme
prop-types-custom
quick and easy creation custom prop types validators for react props
installation:
npm:
npm install @ncodefactory/prop-types-custom --save
yarn:
yarn add @ncodefactory/prop-types-custom
usage:
import default_export_from_the_module_being_used from '@ncodefactory/prop-types-custom';
or
import { some_known_export_from_the_module_being_used } from '@ncodefactory/prop-types-custom';
const validator = value => value.length === 3;
const validatedTypeName = "threeCharString";
const threeCharStringPropType = customPropType(validatedTypeName, validator);
Component.propTypes = {
name: threeCharStringPropType.isRequired,
subName: threeCharStringPropType
};