JavaScript Which redux middleware should I choose?

Following the guide, I came to a sorts of middlewares are there for redux application.

Redux Thunk, Redux Promise, Redux Promise Middleware, Redux Observable, Redux Saga, Redux Pack

It is just a matter of preference around which middleware we choose. But I'm not asking for choosing a convention.

I would like to know if there are any differences between them like performance, browser support, use cases, etc. Or anything else that I'm missing with. I tried a hard research for these but not able to find any article.

So that I can consider choosing a middleware for my application. It will also be great for me to choose middleware if I know the particular use case with different middlewares.

Or, all middlewares are just conventions and I may choose any one of them for any kind of redux application (small or large)?

Answer:1

To be able to choose one of these libraries we must take into account whether we are building a small or large application. Usability, code standards, and JavaScript knowledge may also be considered. All of them are similar.

redux-thunk​

Redux Thunk middleware allows you to write action creators that return a function instead of an action. The thunk can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met. It incorporates the methods dispatch and getState as parameters.

​redux-saga​

redux-saga is a library that aims to make application side effects (i.e. asynchronous like data fetching and impure procedures such as accessing the browser cache) in a manageable and efficient way to execute. It's simple to test as it uses the ES6 feature called generators, making the flow easy to read as synchronous code.

redux-observable

redux-observable is a middleware for redux that is inspired by redux-thunk. It allows developers to dispatch a function that returns an Observable, Promise or iterable of action(s). When the observable emits an action, or the promise resolves an action, or the iterable gives an action out, that action is then dispatched as usual.

And others directly from their github source:

redux-promise

The middleware returns a promise to the caller so that it can wait for the operation to finish before continuing. This is especially useful for server-side rendering.

redux-promise-middleware

Redux promise middleware enables robust handling of async action creators in Redux: it accepts a promise and dispatches pending, fulfilled and rejected actions. The middleware can also be combined with Redux Thunk to chain action creators.

redux-pack

redux-pack is a library that introduces promise-based middleware that allows async actions based on the lifecycle of a promise to be declarative.

Async actions in redux are often done using redux-thunk or other middlewares. The problem with this approach is that it makes it too easy to use dispatch sequentially, and dispatch multiple "actions" as the result of the same interaction/event, where they probably should have just been a single action dispatch.

This can be problematic because we are treating several dispatches as all part of a single transaction, but in reality, each dispatch causes a separate rerender of the entire component tree, where we not only pay a huge performance penalty, but also risk the redux store being in an inconsistent state.

redux-pack helps prevent us from making these mistakes, as it doesn't give us the power of a dispatch function, but allows us to do all of the things we were doing before.

Answer:2

I am animating the entry and exit of an array of items using TransitionGroup and CSSTransition (with a fade effect). I would like the items to appear with a slight delay between them instead of all at ...

I am animating the entry and exit of an array of items using TransitionGroup and CSSTransition (with a fade effect). I would like the items to appear with a slight delay between them instead of all at ...

I'd like to map the value, but only the first time it's emitting. The other times it can pass through. Any ideas? this.sourceStream$.takeUntil(this.onDestroy$).someFunc((data) => { return data['...

I'd like to map the value, but only the first time it's emitting. The other times it can pass through. Any ideas? this.sourceStream$.takeUntil(this.onDestroy$).someFunc((data) => { return data['...

  1. rxjs emit first value
  2. rxjs skip first emit
  3. rxjs get first emitted value

var date ="03/05/2013"; var localDate = date.split("/").reverse().join("-"); var localTime = "20:41" var UTCDateTime = localDate+ "T" + localTime +":00.000Z"; localDateTime = new Date(UTCDateTime) ...

var date ="03/05/2013"; var localDate = date.split("/").reverse().join("-"); var localTime = "20:41" var UTCDateTime = localDate+ "T" + localTime +":00.000Z"; localDateTime = new Date(UTCDateTime) ...

  1. remove comma between quotes
  2. remove comma between names excel
  3. remove comma between numbers python
  4. remove comma between numbers in excel
  5. remove comma between numbers
  6. remove between comma
  7. regex remove comma between quotes
  8. python remove comma between quotes
  9. sed remove comma between quotes
  10. wordpress remove comma between tags
  11. c# remove comma between quotes
  12. regex remove comma between numbers
  13. perl remove comma between quotes
  14. unix remove comma between quotes
  15. bash remove comma between quotes
  16. sed remove comma between double quotes
  17. how to remove comma between words in excel
  18. formula to remove comma between names in excel
  19. remove space between comma

I have done a lot of research and am not sure what the best approach is. I have a Kendo Grid (table) with 3 rows and 3 columns. I show a table with only the first column populated upon initial page ...

I have done a lot of research and am not sure what the best approach is. I have a Kendo Grid (table) with 3 rows and 3 columns. I show a table with only the first column populated upon initial page ...

  1. draw square using css
  2. draw square using dda algorithm
  3. draw square using logo commands
  4. draw square using compass
  5. draw square using repeat command
  6. draw square using opengl
  7. draw square using turtle
  8. draw square using html
  9. draw square using dda
  10. draw square using scratch
  11. draw square using three lines
  12. draw using square
  13. c++ draw square using loop
  14. draw a square using python
  15. draw a square using only 3 lines
  16. draw a square using java
  17. draw a square using turtle python
  18. draw objects using square
  19. how to draw square using autocad
  20. draw an angle square using sine and cosine