react-promiser
A react component to help manage promises
Last updated 2 years ago by bycedric .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-promiser 
SYNC missed versions from official npm registry.

React Promiser

Latest Release Build Status Codecov coverage Code Climate grade

A react component to help manage promises

Example

import { Promiser } from 'react-promiser';
import fetchMyData from './fetch';
import * as State from './states';

function MyComponent() {
    return (
        <Promiser auto promise={fetchMyData}>
            {({ result, error, pending, fulfilled, rejected }) => {
                if (pending) return <State.Loading />;
                if (rejected) return <State.Error error={error} />;
                if (fulfilled && result) return <State.Result result={result} />;

                return <State.Empty />;
            }}
        </Promiser>
    );
}

License

The MIT License (MIT). Please see License File for more information.

Current Tags

  • 0.2.1                                ...           latest (2 years ago)

6 Versions

  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |