react-hit-miss

1.1.1 • Public • Published

React Hit Miss Component

Build Status

jsx conditional rendering inspired by react-router v4

npm install react-hit-miss --save

example

import HitMiss, { Hit, Miss } from 'react-hit-miss';
 
const Awesome = ({ error, items, loading }) => (<HitMiss>
    <Hit
        check={error}
        component={() => (<div>
            {error}
        </div>)}
    />
    <Hit
        check={items && items.length > 0}
        component={() => (<div>
            {items.map(item => <Item {...item} />)}
        </div>)}
    />
    <Hit
        check={loading}
        component={LoadingSpinner}
    />
    <Miss
        component={() => (<div>
            No items found
        </div>)}
    />
</HitMiss>);

Readme

Keywords

none

Package Sidebar

Install

npm i react-hit-miss

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

6.28 kB

Total Files

7

Last publish

Collaborators

  • gorangajic