SlideShare a Scribd company logo
007. REDUX MIDDLEWARE
Presenter: Binh Quan
ReactJS - Redux Middleware
Without middleware
ReactJS - Redux Middleware
With middlewares
ReactJS - Redux Middleware
With middlewares
ReactJS - Redux Middleware
With middlewares
ReactJS - Redux Thunk
❖ Allows you to write action creators that return a function instead of an
action.
❖ Used to delay the dispatch of an action
❖ or to dispatch only if a certain condition is met
Package name: redux-thunk
Github: https://github.com/gaearon/redux-thunk
ReactJS - Implement middleware to Store
Without middleware
With middleware
ReactJS - Implement middleware to Store
With middleware - method #1
With middleware - method #2
ReactJS - Implement middleware to Store
With single middleware
With multiple middleware
ReactJS - Redux Thunk
Normal action Thunk action Thunk with conditional dispatch
ReactJS - HTTP Clients
fetch axios
Github: https://github.com/mzabriskie/axiosGithub: https://github.com/github/fetch
Get JSON content
Send POST data
Get JSON content
Send POST data
ReactJS - HTTP Clients
Benefits of Axios over Fetch
# Feature Axios Fetch
1 Allow data transforming before request is made YES NO
2 Interceptors: Alter request or response YES NO
3 XSRF protection YES NO
4 Allow aborting a request YES NO
5 Request timeout support YES NO
6 Safari support YES With Polyfill
7 Upload progress support YES NO
ReactJS - Poor Practice API call
ReactJS - Redux Practice API call
ReactJS - Using Axios
React Component Redux Actions
ReactJS - Redux API
❖ redux-thunk itself doesn’t implement any HTTP Client
❖ Generate actions and reducers for making AJAX calls to API endpoints
❖ Github: https://github.com/lexich/redux-api
ReactJS - Redux-api configuration
Folder structures users.js
ReactJS - Redux-api configuration
Folder structures axios.js
ReactJS - Redux-api configuration
Folder structures posts.js
ReactJS - Redux-api configuration
Folder structures index.js
ReactJS - Redux-api configuration
Reducers (reducers/index.js) Chrome console log
ReactJS - Redux-api configuration
Create store with API reducers
ReactJS - Redux-api configuration
Dispatch an API action
ReactJS - Redux-api configuration
Dispatch an API action
Next:
Redux Saga
Now Demo

More Related Content

What's hot (20)

PDF
Introduction to ReactJS
Hoang Long
 
PDF
Running JavaScript Efficiently in a Java World
irbull
 
PDF
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
Max Andersen
 
PPTX
Getting started with node.js
Mudassar Ali Sahil
 
PPTX
Introduction to ReactJs & fundamentals
websyndicate
 
PDF
Webpack DevTalk
Alessandro Bellini
 
PDF
Mastering Grails 3 Plugins - Greach 2016
Alvaro Sanchez-Mariscal
 
PPTX
A Brief Introduction to React.js
Doug Neiner
 
PDF
Forget Grunt and Gulp! Webpack and NPM rule them all!
Derek Willian Stavis
 
PDF
Webpack
DataArt
 
PDF
Breaking the Server-Client Divide with Node.js and React
Dejan Glozic
 
PPTX
Grunt and Bower
George Estebe
 
PDF
Robust web apps with React.js
Max Klymyshyn
 
PDF
Introduction to ReactJS
Tu Hoang
 
PPTX
Introduction to react_js
MicroPyramid .
 
PDF
Service workers
jungkees
 
PDF
Nuxt.js - Introduction
Sébastien Chopin
 
PPTX
Nuxt Talk
Sébastien Chopin
 
PDF
React JS - Introduction
Sergey Romaneko
 
PPTX
Angular 1.5 Components
José Barbosa
 
Introduction to ReactJS
Hoang Long
 
Running JavaScript Efficiently in a Java World
irbull
 
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
Max Andersen
 
Getting started with node.js
Mudassar Ali Sahil
 
Introduction to ReactJs & fundamentals
websyndicate
 
Webpack DevTalk
Alessandro Bellini
 
Mastering Grails 3 Plugins - Greach 2016
Alvaro Sanchez-Mariscal
 
A Brief Introduction to React.js
Doug Neiner
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Derek Willian Stavis
 
Webpack
DataArt
 
Breaking the Server-Client Divide with Node.js and React
Dejan Glozic
 
Grunt and Bower
George Estebe
 
Robust web apps with React.js
Max Klymyshyn
 
Introduction to ReactJS
Tu Hoang
 
Introduction to react_js
MicroPyramid .
 
Service workers
jungkees
 
Nuxt.js - Introduction
Sébastien Chopin
 
React JS - Introduction
Sergey Romaneko
 
Angular 1.5 Components
José Barbosa
 

Viewers also liked (20)

PPTX
003. ReactJS basic
Binh Quan Duc
 
PPTX
006. React - Redux framework
Binh Quan Duc
 
PPTX
React + Redux Introduction
Nikolaus Graf
 
PPTX
001. Introduction about React
Binh Quan Duc
 
PPTX
002. Working with Webpack
Binh Quan Duc
 
PDF
React + Redux for Web Developers
Jamal Sinclair O'Garro
 
PDF
RxJS + Redux + React = Amazing
Jay Phelps
 
PPTX
004. Working with React component
Binh Quan Duc
 
PPTX
005. a React project structure
Binh Quan Duc
 
PPTX
Reactjs
Neha Sharma
 
PDF
React lecture
Christoffer Noring
 
PDF
Redux tutorial - intro to Redux by GetLittleTech
Oleg Kosuchin (GetLittleTech)
 
PDF
Workshop 22: ReactJS Redux Advanced
Visual Engineering
 
PDF
Intro to ReactJS
Harvard Web Working Group
 
PPSX
Frd nafs
georgetrianta
 
DOCX
Health report
Imran Riaz
 
PPTX
Windows 7
Mumbere Joab
 
PDF
Capitulo 5 de el libro blanco de las tic
Universidad del QuindÍo
 
PPTX
The lost ones
Melanie Woodward
 
PDF
Intro matlab msantos
Laureano Zantedeschi
 
003. ReactJS basic
Binh Quan Duc
 
006. React - Redux framework
Binh Quan Duc
 
React + Redux Introduction
Nikolaus Graf
 
001. Introduction about React
Binh Quan Duc
 
002. Working with Webpack
Binh Quan Duc
 
React + Redux for Web Developers
Jamal Sinclair O'Garro
 
RxJS + Redux + React = Amazing
Jay Phelps
 
004. Working with React component
Binh Quan Duc
 
005. a React project structure
Binh Quan Duc
 
Reactjs
Neha Sharma
 
React lecture
Christoffer Noring
 
Redux tutorial - intro to Redux by GetLittleTech
Oleg Kosuchin (GetLittleTech)
 
Workshop 22: ReactJS Redux Advanced
Visual Engineering
 
Intro to ReactJS
Harvard Web Working Group
 
Frd nafs
georgetrianta
 
Health report
Imran Riaz
 
Windows 7
Mumbere Joab
 
Capitulo 5 de el libro blanco de las tic
Universidad del QuindÍo
 
The lost ones
Melanie Woodward
 
Intro matlab msantos
Laureano Zantedeschi
 
Ad

Similar to 007. Redux middlewares (20)

PPTX
Redux workshop
Imran Sayed
 
PPTX
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
PDF
How to Redux
Ted Pennings
 
PDF
Reduxing like a pro
Boris Dinkevich
 
PPTX
U3-02-React Redux and MUI.pptxaSDFGNXDASDFG
vinodkumarthatipamul
 
PDF
Side effects-con-redux
Nicolas Quiceno Benavides
 
PDF
Workshop 22: React-Redux Middleware
Visual Engineering
 
PDF
Redux js
Nils Petersohn
 
PPTX
Presentation1.pptx
PradeepDyavannanavar
 
PPTX
an Introduction to Redux
Amin Ashtiani
 
PPTX
Redux
Maulik Shah
 
PDF
React Redux Interview Questions PDF By ScholarHat
Scholarhat
 
PDF
React Redux Interview Questions PDF By ScholarHat
Scholarhat
 
PDF
A React Journey
LinkMe Srl
 
PPTX
Async Redux Actions With RxJS - React Rally 2016
Ben Lesh
 
PDF
Materi Modern React Redux Power Point.pdf
exiabreak
 
PDF
Redux
Marco Lanaro
 
PDF
Redux Deep Dive - ReactFoo Pune 2018
Aziz Khambati
 
PDF
Building Modern Web Applications using React and Redux
Maxime Najim
 
PDF
Redux. From twitter hype to production
Jenya Terpil
 
Redux workshop
Imran Sayed
 
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
How to Redux
Ted Pennings
 
Reduxing like a pro
Boris Dinkevich
 
U3-02-React Redux and MUI.pptxaSDFGNXDASDFG
vinodkumarthatipamul
 
Side effects-con-redux
Nicolas Quiceno Benavides
 
Workshop 22: React-Redux Middleware
Visual Engineering
 
Redux js
Nils Petersohn
 
Presentation1.pptx
PradeepDyavannanavar
 
an Introduction to Redux
Amin Ashtiani
 
React Redux Interview Questions PDF By ScholarHat
Scholarhat
 
React Redux Interview Questions PDF By ScholarHat
Scholarhat
 
A React Journey
LinkMe Srl
 
Async Redux Actions With RxJS - React Rally 2016
Ben Lesh
 
Materi Modern React Redux Power Point.pdf
exiabreak
 
Redux Deep Dive - ReactFoo Pune 2018
Aziz Khambati
 
Building Modern Web Applications using React and Redux
Maxime Najim
 
Redux. From twitter hype to production
Jenya Terpil
 
Ad

Recently uploaded (20)

PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
PDF
How to get the licensing right for Microsoft Core Infrastructure Server Suite...
Q-Advise
 
PDF
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
PDF
chapter 5.pdf cyber security and Internet of things
PalakSharma980227
 
PDF
ESUG 2025: Pharo 13 and Beyond (Stephane Ducasse)
ESUG
 
PDF
10 Salesforce Consulting Companies in Sydney.pdf
DianApps Technologies
 
PPTX
Transforming Lending with IntelliGrow – Advanced Loan Software Solutions
Intelli grow
 
PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PDF
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
 
PPTX
UI5con_2025_Accessibility_Ever_Evolving_
gerganakremenska1
 
PPTX
Cutting Optimization Pro 5.18.2 Crack With Free Download
cracked shares
 
PDF
AI Software Engineering based on Multi-view Modeling and Engineering Patterns
Hironori Washizaki
 
PDF
Windows 10 Professional Preactivated.pdf
asghxhsagxjah
 
PPTX
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
PPTX
BB FlashBack Pro 5.61.0.4843 With Crack Free Download
cracked shares
 
PDF
Latest Capcut Pro 5.9.0 Crack Version For PC {Fully 2025
utfefguu
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PPTX
ChessBase 18.02 Crack + Serial Key Free Download
cracked shares
 
PPTX
TexSender Pro 8.9.1 Crack Full Version Download
cracked shares
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 31 2025?
utfefguu
 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
How to get the licensing right for Microsoft Core Infrastructure Server Suite...
Q-Advise
 
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
chapter 5.pdf cyber security and Internet of things
PalakSharma980227
 
ESUG 2025: Pharo 13 and Beyond (Stephane Ducasse)
ESUG
 
10 Salesforce Consulting Companies in Sydney.pdf
DianApps Technologies
 
Transforming Lending with IntelliGrow – Advanced Loan Software Solutions
Intelli grow
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
 
UI5con_2025_Accessibility_Ever_Evolving_
gerganakremenska1
 
Cutting Optimization Pro 5.18.2 Crack With Free Download
cracked shares
 
AI Software Engineering based on Multi-view Modeling and Engineering Patterns
Hironori Washizaki
 
Windows 10 Professional Preactivated.pdf
asghxhsagxjah
 
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
BB FlashBack Pro 5.61.0.4843 With Crack Free Download
cracked shares
 
Latest Capcut Pro 5.9.0 Crack Version For PC {Fully 2025
utfefguu
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
ChessBase 18.02 Crack + Serial Key Free Download
cracked shares
 
TexSender Pro 8.9.1 Crack Full Version Download
cracked shares
 
IDM Crack with Internet Download Manager 6.42 Build 31 2025?
utfefguu
 

007. Redux middlewares

  • 2. ReactJS - Redux Middleware Without middleware
  • 3. ReactJS - Redux Middleware With middlewares
  • 4. ReactJS - Redux Middleware With middlewares
  • 5. ReactJS - Redux Middleware With middlewares
  • 6. ReactJS - Redux Thunk ❖ Allows you to write action creators that return a function instead of an action. ❖ Used to delay the dispatch of an action ❖ or to dispatch only if a certain condition is met Package name: redux-thunk Github: https://github.com/gaearon/redux-thunk
  • 7. ReactJS - Implement middleware to Store Without middleware With middleware
  • 8. ReactJS - Implement middleware to Store With middleware - method #1 With middleware - method #2
  • 9. ReactJS - Implement middleware to Store With single middleware With multiple middleware
  • 10. ReactJS - Redux Thunk Normal action Thunk action Thunk with conditional dispatch
  • 11. ReactJS - HTTP Clients fetch axios Github: https://github.com/mzabriskie/axiosGithub: https://github.com/github/fetch Get JSON content Send POST data Get JSON content Send POST data
  • 12. ReactJS - HTTP Clients Benefits of Axios over Fetch # Feature Axios Fetch 1 Allow data transforming before request is made YES NO 2 Interceptors: Alter request or response YES NO 3 XSRF protection YES NO 4 Allow aborting a request YES NO 5 Request timeout support YES NO 6 Safari support YES With Polyfill 7 Upload progress support YES NO
  • 13. ReactJS - Poor Practice API call
  • 14. ReactJS - Redux Practice API call
  • 15. ReactJS - Using Axios React Component Redux Actions
  • 16. ReactJS - Redux API ❖ redux-thunk itself doesn’t implement any HTTP Client ❖ Generate actions and reducers for making AJAX calls to API endpoints ❖ Github: https://github.com/lexich/redux-api
  • 17. ReactJS - Redux-api configuration Folder structures users.js
  • 18. ReactJS - Redux-api configuration Folder structures axios.js
  • 19. ReactJS - Redux-api configuration Folder structures posts.js
  • 20. ReactJS - Redux-api configuration Folder structures index.js
  • 21. ReactJS - Redux-api configuration Reducers (reducers/index.js) Chrome console log
  • 22. ReactJS - Redux-api configuration Create store with API reducers
  • 23. ReactJS - Redux-api configuration Dispatch an API action
  • 24. ReactJS - Redux-api configuration Dispatch an API action