You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`createCycleMiddleware()` no longer takes any arguments. Instead you need to call `Cycle.run` yourself (which can be installed via `npm i -s @cycle/xstream-run`) passing it your `main` function and `drivers` explicitly:
`createCycleMiddleware()` apart from returning the middleware function, also has two function properties attached to it; namely the `makeActionDriver()` and the `makeStateDriver()` which you can use accordingly when you call `Cycle.run`.
Copy file name to clipboardExpand all lines: README.md
+12-19Lines changed: 12 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,10 @@ Handle redux async actions using [Cycle.js](https://cycle.js.org/).
30
30
31
31
`npm install --save redux-cycles`
32
32
33
-
Then use `createCycleMiddleware()` which takes as first argument your `main` Cycle.js function, and second argument the Cycle.js drivers you want to use:
33
+
Then use `createCycleMiddleware()` which returns the redux middleware function, but also has two function properties attached to it; namely `makeActionDriver()`and `makeStateDriver()` which you can use accordingly when you call `Cycle.run` (which can be installed via `npm i -s @cycle/xstream-run`).
Try out this [JS Bin](https://jsbin.com/govola/10/edit?js,output).
64
+
Try out this [JS Bin](https://jsbin.com/bomugapuxi/2/edit?js,output).
59
65
60
66
See a real world example: [cycle autocomplete](https://github.com/cyclejs-community/redux-cycles/blob/master/example/cycle/index.js).
61
67
@@ -242,8 +248,8 @@ This middleware intercepts Redux actions and allows us to handle them using Cycl
242
248
243
249
Redux-cycles ships with two drivers:
244
250
245
-
*`ACTION`, which is a read-write driver, allowing to react to actions that have just happened, as well as to dispatch new actions.
246
-
*`STATE`, which is a read-only driver that streams the current redux state. It's a reactive counterpart of the `yield select(state => state)` effect in Redux-saga.
251
+
*`makeActionDriver()`, which is a read-write driver, allowing to react to actions that have just happened, as well as to dispatch new actions.
252
+
*`makeStateDriver()`, which is a read-only driver that streams the current redux state. It's a reactive counterpart of the `yield select(state => state)` effect in Redux-saga.
Here's an example on [how the STATE driver works](https://jsbin.com/kijucaw/7/edit?js,output).
267
-
268
-
NOTE: If you want to use any other driver aside ACTION and STATE, make sure to have it installed and registered. You can do so at instantiation time, via the `createCycleMiddleware` API.
0 commit comments