Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A library that ports Elm's effect system to Redux

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-logo.md
NotificationsYou must be signed in to change notification settings

redux-loop/redux-loop

redux-loop

A port of theElm Architecture to Redux that allows you to sequence your effects naturally and purely by returning them from your reducers.

Isn't it incorrect to cause side-effects in a reducer?

Yes! Absolutely.

Doesn't redux-loop put side-effects in the reducer?

It doesn't. The values returned from the reducer when scheduling an effect withredux-loop onlydescribe the effect. Calling the reducer will not cause theeffect to run. The value returned by the reducer is just an object that thestore knows how to interpret when it is enhanced by redux-loop. You can safelycall a reducer in your tests without worrying about waiting for effects to finishand what they will do to your environment.

What are the environment requirements for redux-loop?

redux-loop requires polyfills for ES6Promise andSymbol to be included ifthe browsers you target don't natively support them.

Why use this?

Having used and followed the progression of Redux and the Elm Architecture, andafter trying other effect patterns for Redux, we came to the followingconclusion:

Synchronous state transitions caused by returning a new state from the reducerin response to an action are just one of all possible effects an action canhave on application state.

Many other methods for handling effects in Redux, especially those implementedwith action-creators, incorrectly teach the user that asynchronous effects arefundamentally different from synchronous state transitions. This separationencourages divergent and increasingly specific means of processing particulartypes effects. Instead, we should focus on making our reducers powerful enoughto handle asynchronous effects as well as synchronous state transitions. Withredux-loop, the reducer doesn't just decide what happensnow due to aparticular action, it decides what happensnext. All of the behavior of yourapplication can be traced through one place, and that behavior can be easily brokenapart and composed back together. This is one of the most powerful features of theElm architecture, and withredux-loop it is a feature of Redux as well.

Installation

npm install --save redux-loop

Support

Potential bugs, general discussion, and proposals or RFCs should be submittedas issues to this repo, we'll do our best to address them quickly. We use thislibrary as well and want it to be the best it can! For questions about using thelibrary,submit questions on StackOverflowwith theredux-loop tag.

Don't see a feature you want?

If you're interested in adding something toredux-loop but don't want to waitfor us to incorporate the idea you can follow these steps to get your own installableversion ofredux-loop with your feature included:

  1. Fork the main repo here
  2. Add your feature or change
  3. Change the package"name" in package.json to be"@<your-npm-username>/redux-loop
  4. Commit to master andnpm publish
  5. npm install @<your-npm-username>/redux-loop

We arealways interested in new ideas, but sometimes we get a little busy and fallbehind on responding and reviewing PRs. Hopefully this process will allow you tocontinue making progress on your projects and also provide us with more context if andwhen you do decide to make a PR for your new feature or change. The best way to verifynew features for a library is to use them in real-world scenarios!

Contributing

Please note that this project is released with aContributor Code of Conduct. By participating in this project you agree to abide by its terms. Multiple language translations are available atcontributor-covenant.org

About

A library that ports Elm's effect system to Redux

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-logo.md

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors51


[8]ページ先頭

©2009-2025 Movatter.jp