Skip to content

An implementation of ember-concurrency for React components.

License

Notifications You must be signed in to change notification settings

iamdtang/react-concurrency

Repository files navigation

Build Status

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 and isIdle 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.

  1. Clone this repo
  2. Inside cloned repo run npm install
  3. If you want to run tests: npm test or npm run testonly or npm run test-watch. You need to write tests in __tests__ folder. You need at least Node 4 on your machine to run tests.
  4. If you want to run linting: npm test or npm run lint. Fix bugs: npm run lint-fix. You can adjust your .eslintrc config file.
  5. If you want to run transpilation to ES5 in dist folder: npm run prepublish (standard npm hook).

About

An implementation of ember-concurrency for React components.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published