react-concurrency
v0.0.10
Published
ember-concurrency for React components
Downloads
8
Maintainers
Readme
React Concurrency
An implementation of ember-concurrency for React components. This is still a work in progress.
Current Implemented Features
- Tasks get automatically canceled when the component they live on is destroyed
- Derived state with
isRunning
andisIdle
flags - promise based
timeout
Installation
npm install react-concurrency
Why?
Have you ever seen the error?
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the YourComponent component.
There are a few ways to deal with this in React. Read about them here.
In Ember, this is solved with a brilliant addon called ember-concurrency. This library attempts to do the same but for React components while keeping a similar API. If you haven't read about ember-concurrency, check out this great article: ember-concurrency: the solution to so many problems you never knew you had.
Run the examples here: https://github.com/skaterdav85/react-concurrency-demos.
About This Repo
This repo was created with react-npm-boilerplate.
- Clone this repo
- Inside cloned repo run
npm install
- If you want to run tests:
npm test
ornpm run testonly
ornpm run test-watch
. You need to write tests in__tests__
folder. You need at least Node 4 on your machine to run tests. - If you want to run linting:
npm test
ornpm run lint
. Fix bugs:npm run lint-fix
. You can adjust your.eslintrc
config file. - If you want to run transpilation to ES5 in
dist
folder:npm run prepublish
(standard npm hook).