Consuming services reliably in Redux without losing your mind
Submitted by Sidhartha Chatterjee (@sidharthachatterjee) on Wednesday, 15 March 2017
Section: Crisp Talk Technical level: Intermediate
With most apps being built with React these days and Redux being a very popular state management library, have we identified a standard pattern for consuming APIs?
What about JWT, automatic retries, caching, optimistic updates and handing failure?
This talk approaches all of the above and identifies reusable patterns to make this a breeze.
We identify potential issues with the most common ways of consuming services, in
How do we fix this
- we write simple middleware to handle API calls and define a standard for actions that trigger this
- we build a mechanism for handling JWT with automatic token refresh and storage
- we build an automatic failure and retry mechanism
- we add caching into the mix
It looks like we just built a really reliable web app, folks.
Sidhartha is a software developer and entrepreneur with a passion for finding elegant solutions to hard problems, and tiramisu.
He has previously worked for Insider.in where he built much of the complex microservices and setup infrastructure.
Besides functional programming and DevOps, he has special interests in serverless computing. On Sundays, you’ll find him playing the guitar or walking his dog, Love.