react-async-decorator
New way to organize your asynchronous flow in react applications. inspired by Dan Abramov: Beyond React 16.
Getting Started
Installing
npm install react-async-decorator
If you prefer yarn
yarn react-async-decorator
Simple example
;const config = ;const fetcher = config; // If you don't want to use decorators, it should be replaced next syntax// const WrapTest = asyncClass(fetcher)(Test);@Component { const data = fetcher; // This content will be rendered after success response of fetch request return <div>data</div>; } { // This content will be rendered while fetch request in progress return <div>Loading</div>; } { // This content will be rendered after fail response of fetch request return <div>errmessage</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
- Efremov Alexey - lexich
License
This project is licensed under the MIT License - see the LICENSE.md file for details