1.0.2 • Published 1 year ago

conditional-component-for-react v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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 😉