conditional-component-for-react

1.0.2 • Public • Published

Getting Started with If Else React component

This project it's a simple if else component for React

Examples

instead using conditions like this.

    {
        1 === 1 ? <Component /> : <Component />
    }

or

    {
        1 === 1 && <Component />
    }

you could use like this

    <Conditional
        condition={1 === 1}
        then={<p>Hi! I'm content for true value</p>}
        else={<p>Hello! I'm content for false value</p>} // this component is optional
    />
    <Conditional
        condition={1 === 1}
        then={<Component />}
    />

It's very simple and clean. I hope that you like 😉

/conditional-component-for-react/

    Package Sidebar

    Install

    npm i conditional-component-for-react

    Weekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    2.16 kB

    Total Files

    2

    Last publish

    Collaborators

    • rodrigo-97