1.0.0 • Published 7 years ago
@ncodefactory/prop-types-custom v1.0.0
prop-types-custom
quick and easy creation custom prop types validators for react props
installation:
npm:
npm install @ncodefactory/prop-types-custom --saveyarn:
yarn add @ncodefactory/prop-types-customusage:
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
};1.0.0
7 years ago