redux-batch-middleware | Batch Redux actions | State Container library
kandi X-RAY | redux-batch-middleware Summary
kandi X-RAY | redux-batch-middleware Summary
Batch Redux actions
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of redux-batch-middleware
redux-batch-middleware Key Features
redux-batch-middleware Examples and Code Snippets
Community Discussions
Trending Discussions on redux-batch-middleware
QUESTION
const fetchListEpic = (action$, store) =>
action$.ofType('LOAD_LIST')
.switchMap(() =>
concat$(
of$(openLoader()),
fromPromise$(fetchListFromServer())
.flatMap(list => of$(loadListSucceeded(list), closeLoader()))
.catch(e =>
of$(
openSnackbar('ERROR'),
closeLoader(),
),
),
)
);
...ANSWER
Answered 2017-Nov-09 at 20:52redux-batched-actions works well with redux-observable. Here's a demo, where you can see in the console that it only rerenders once despite there being PONG
and SECOND_PONG
sequentially:
https://jsbin.com/kewomex/edit?js,console,output
Edit, based on your edits and comments:Can we use https://github.com/mrydengren/redux-batch-middleware? The redux-batch-middleware expects array of actions but redux-observable works only for objects.
Yep! In fact, you can use [nearly] any middleware with redux-observable. redux-observable itself doesn't know anything about the things your epics dispatch. It just does:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redux-batch-middleware
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page