Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doodledood/redux-fx
A library to manage side effects for Redux based on the Elm Architecture
https://github.com/doodledood/redux-fx
Last synced: about 2 months ago
JSON representation
A library to manage side effects for Redux based on the Elm Architecture
- Host: GitHub
- URL: https://github.com/doodledood/redux-fx
- Owner: doodledood
- License: other
- Created: 2016-03-22T15:59:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-01T11:12:00.000Z (over 8 years ago)
- Last Synced: 2024-11-14T02:37:25.092Z (2 months ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
THIS LIBRARY IS CURRENTLY NOT MAINTAINED
redux-fx
A library for managing side effects for Redux, inspired by the Elm Architecture.## Install
```sh
npm install redux-fx
```## Usage
```js
import {enhanceStoreWithEffects, fx} from "redux-fx"...
// Decorate createStore with enhanceStoreWithEffects to enable support for effects
const createStoreWithMiddleware = compose(
applyMiddleware(someMiddleware),
devTools(),
enhanceStoreWithEffects()
)(createStore);...
// Create effects of signature (any) => (dispatch, getState) => (any)
const incrementWithDelay = seconds => dispatch => setTimeout(() => dispatch({type: "INCREMENT"}), seconds * 1000);...
// Return a [state,effect] tuple to create effect descriptors that are fully testable.
const reducer = (state, action) => {
switch (action.type) {
case "INCREMENT":
return [{count: state.count + 1}, fx(incrementWithDelay, 1)];
case "DECREMENT":
return {count: state.count - 1};
default:
return state;
}
};```
## License
MIT © [doodledood](http://github.com/doodledood)
[npm-url]: https://npmjs.org/package/redux-fx
[npm-image]: https://img.shields.io/npm/v/redux-fx.svg?style=flat-square[travis-url]: https://travis-ci.org/doodledood/redux-fx
[travis-image]: https://img.shields.io/travis/doodledood/redux-fx.svg?style=flat-square[coveralls-url]: https://coveralls.io/r/doodledood/redux-fx
[coveralls-image]: https://img.shields.io/coveralls/doodledood/redux-fx.svg?style=flat-square[depstat-url]: https://david-dm.org/doodledood/redux-fx
[depstat-image]: https://david-dm.org/doodledood/redux-fx.svg?style=flat-square[download-badge]: http://img.shields.io/npm/dm/redux-fx.svg?style=flat-square