Showing posts with label redux-thunk. Show all posts
Showing posts with label redux-thunk. Show all posts

Thursday, February 22, 2018

Why do we need middleware for async flow in Redux?



According to the docs, "Without middleware, Redux store only supports synchronous data flow". I don't understand why this is the case. Why can't the container component call the async API, and then dispatch the actions? For example, imagine a simple UI: a field and a button.

Sunday, December 31, 2017

Redux Testing Step by Step: A Simple Methodology for Testing Business Logic



Part two of our Redux workflow series. A well-implemented system is only half the work. The other half is an automated suite of tests proving our system is behaving according to spec. This is a crucial factor in increasing our engineering velocity.

Unit testing with Jest: Redux + async actions + fetch



LAST UPDATE: June 24, 2017. Original writing: May 19, 2016. I have been using Jest since its beginnings. I won’t lie, the path has been painful: Things like updating from version 0.x.0 to version 0.y.0 (specially to version 0.4.0) was particularly terrible for my tests.

Thursday, December 21, 2017

Test redux actions that calls an API



export function receivingItems() { return (dispatch, getState) => { axios.get('/api/items') .then(function(response) { dispatch(receivedItems(response.data)); }); }; } describe('Items Action Creator', () => { it('should create a receiving items function', () => { expect(receivingItems()).to.be.a.

bundlephobia

JavaScript bloat is a more real problem today than it ever was. Bundlephobia lets you understand the performance cost of adding a npm pack...