Neanderthal Painting Monet

    element-prop-types
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    element-prop-types

    React PropTypes for props-elements

    npm npm GitHub license

    Install

    npm install --save element-prop-types
    

    Usage

    const ElementPropTypes = require('element-prop-types');
     
    const Modal = ({ header, items }) => (
        <div>
            <div>{header}</div>
            <div>{items}</div>
        </div>
    );
     
    Modal.propTypes = {
        header: ElementPropTypes.elementOf(Header).isRequired,
        items: PropTypes.arrayOf(ElementPropTypes.elementOf(Item))
    };
     
    // render Modal
    React.render(
        <Modal
           header={<Header title="This is modal" />}
           items={[
               <Item/>,
               <Item/>,
               <Item/>
           ]}
        />,
        rootElement
    );

    API

    elementOf(Component)

    checks the type of a React element

    Install

    npm i element-prop-types

    DownloadsWeekly Downloads

    2

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    3.48 kB

    Total Files

    5

    Last publish

    Collaborators

    • ardalanamini