0.2.8 • Published 5 years ago

react-async-decorator v0.2.8

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

react-async-decorator

New way to organize your asynchronous flow in react applications. inspired by Dan Abramov: Beyond React 16.

Build Status

Getting Started

Installing

npm install react-async-decorator

If you prefer yarn

yarn react-async-decorator

Simple example

import { asyncClass, initFetchers } from 'react-async-decorator';
const config = initFetchers();
const fetcher = config.createFetcher(() => fetch('/data.json'));

// If you don't want to use decorators, it should be replaced next syntax
// const WrapTest = asyncClass(fetcher)(Test);
@asyncClass(fetcher)
class Test extends React.Component {
    render() {
        const data = fetcher.get();
        // This content will be rendered after success response of fetch request
        return <div>{data}</div>;
    }
    renderLoader() {
        // This content will be rendered while fetch request in progress
        return <div>Loading</div>;
    }
    renderError(err) {
        // This content will be rendered after fail response of fetch request
        return <div>{err.message}</div>;
    }
}

Documentation

Running the tests

All unit tests are in __tests__ folder. They are written with jest.

npm test

Contributing

We are happy any contributions. Please be aware of all unit-tests and linters passed.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository. Thanks for standard-version for automation.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago