SlideShare a Scribd company logo
1 of 49
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Beginner to advanced
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
itemList: [ ]
Component-2
Component-1
Component-3
Display
Component
Parent Component
Child Components
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
itemList: [ ]
Component-2
Component-1
Component-3
Display
Component
{id: 1}
Parent Component State
Child Components
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
itemList: [ {id: 1} ]
Component-2
Component-1
Component-3
Display
Component
Parent Component State
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
itemList: [ {id: 1} ]
Component-2
Component-1
Component-3
Display
Component
{id: 2}
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
itemList: [ {id: 1} , {id: 2} ]
Component-2
Component-1
Component-3
Display
Component
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
Component-2
Component-1
Component-3
Display
Component
{id: 1}
{uid: 3}
{id: 2},itemList: [ {id: 1} , {id: 2} ]
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
itemList: [ {id: 1} , {id: 2} , { uid: 3} ]
Component-2
Component-1
Component-3
Display
Component
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
Component-2
Component-1
Component-3
Display
Component
{id: 1} {id: 2} , { uid: 3}itemList: [ {id: 1} , {id: 2} , { uid: 3} ]
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Why Redux
Component-2
Component-1
Component-3
Display
Component
itemList: [ {id: 1} , {id: 2} , { uid: 3} ]
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Problems
• Hard to identify component with wrong logic.
• Need rework to see intermediate state of app.
• What if 100s of component updating same complex data.
• Passing data through long chain of nested components.
• Problems due to data mutation takes hours to debug and
then finally you realize the issue and you are like ….
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Store
• Store is nothing but simple
javaScript object which
holds application
state/data.
Store State
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
• What is store state.
• Single instance of store will be used throughout
application.
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store Action1
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Action
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store Action1
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store's
state-1 Action1
Store's state1
Action1
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store
state-1 Action2
Store's state1
Action1
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store's
state-2 Action2
Store's state1
Action1
Store's state2
Action2
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store's
state-2 Action3
Store's state1
Action1
Store's state2
Action2
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux
Component-2
Component-1
Component-3
Display
Component
Store's
state-3 Action3
Store's state1
Action1
Store's state2
Action2
Store's state3
Action3
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Reducer
• Reducer is just a function
which understands action
that components raise or
dispatches.
• It is responsible for taking
out payload/data from
action and appropriately
storing it in redux store.
• You will write actions as
well as reducer
24
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Redux data
flow
25
Credits: Medium.com
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Demo ...
Vanilla Redux
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Any Questions
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
You might not need redux ...
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
React Redux
• Connect api helps application to connect with redux
store.
• It creates wrapper component around our component
• It avoids some grunt work
– like subscribing to store in each component.
– Import store and passing dispatch to every component
– Optimization to avoid unnecessary re-renders when store
changes.
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Demo ...
React Redux
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Connect api code
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Cross Slice Reducer …
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Multiple stores
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Normalized Store
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Normalized Store
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Chrome Plugin
Demo ...
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Replace Reducer
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Replace Reducer
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Hot reloading for faster
development
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Preloaded state
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Most Important, Interesting and
Easy part of Redux.
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Middleware
Credits: tenor.com
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Let's see how middleware works.
Syntax is available on docs as well.
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Component dispatches
action
Middleware 1 Middleware 2 Middleware 3
Reducer
Action
Action Action
Action
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Demo ...
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
Thunk Middleware
Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights

More Related Content

Similar to Redux JavaScript Meetup - Talentica, Saturday, July 6, 2019

Similar to Redux JavaScript Meetup - Talentica, Saturday, July 6, 2019 (20)

React advance
React advanceReact advance
React advance
 
How to Avoid Common Mistakes at Scale: AWS Developer Workshop at Web Summit 2018
How to Avoid Common Mistakes at Scale: AWS Developer Workshop at Web Summit 2018How to Avoid Common Mistakes at Scale: AWS Developer Workshop at Web Summit 2018
How to Avoid Common Mistakes at Scale: AWS Developer Workshop at Web Summit 2018
 
Building Microservices with the Twelve-Factor App Pattern - SRV346 - Chicago ...
Building Microservices with the Twelve-Factor App Pattern - SRV346 - Chicago ...Building Microservices with the Twelve-Factor App Pattern - SRV346 - Chicago ...
Building Microservices with the Twelve-Factor App Pattern - SRV346 - Chicago ...
 
Microapps: Redefining Enterprise Mobility
Microapps: Redefining Enterprise MobilityMicroapps: Redefining Enterprise Mobility
Microapps: Redefining Enterprise Mobility
 
Devoxx - Bug Wars: Episode IV - A New Hope
Devoxx - Bug Wars: Episode IV - A New HopeDevoxx - Bug Wars: Episode IV - A New Hope
Devoxx - Bug Wars: Episode IV - A New Hope
 
Serverless + Evolutionary Architectures + Safe Deployments = Speed in the Rig...
Serverless + Evolutionary Architectures + Safe Deployments = Speed in the Rig...Serverless + Evolutionary Architectures + Safe Deployments = Speed in the Rig...
Serverless + Evolutionary Architectures + Safe Deployments = Speed in the Rig...
 
How Cox Automotive Runs GitHub Enterprise on AWS (ENT356-S) - AWS re:Invent 2018
How Cox Automotive Runs GitHub Enterprise on AWS (ENT356-S) - AWS re:Invent 2018How Cox Automotive Runs GitHub Enterprise on AWS (ENT356-S) - AWS re:Invent 2018
How Cox Automotive Runs GitHub Enterprise on AWS (ENT356-S) - AWS re:Invent 2018
 
APIdays Paris 2018 - The State of the API Industry Paolo Malinverno, VP Resea...
APIdays Paris 2018 - The State of the API Industry Paolo Malinverno, VP Resea...APIdays Paris 2018 - The State of the API Industry Paolo Malinverno, VP Resea...
APIdays Paris 2018 - The State of the API Industry Paolo Malinverno, VP Resea...
 
Perth APAC Groundbreakers tour - The Autonomous Database
Perth APAC Groundbreakers tour - The Autonomous DatabasePerth APAC Groundbreakers tour - The Autonomous Database
Perth APAC Groundbreakers tour - The Autonomous Database
 
Machine Learning Your Eight-Year-Old Would Be Proud Of (AIM390) - AWS re:Inve...
Machine Learning Your Eight-Year-Old Would Be Proud Of (AIM390) - AWS re:Inve...Machine Learning Your Eight-Year-Old Would Be Proud Of (AIM390) - AWS re:Inve...
Machine Learning Your Eight-Year-Old Would Be Proud Of (AIM390) - AWS re:Inve...
 
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
 
Advanced Serverless Data Processing (GPSWS406) - AWS re:Invent 2018
Advanced Serverless Data Processing (GPSWS406) - AWS re:Invent 2018Advanced Serverless Data Processing (GPSWS406) - AWS re:Invent 2018
Advanced Serverless Data Processing (GPSWS406) - AWS re:Invent 2018
 
IoT Microcontrollers and Getting Started with Amazon FreeRTOS (IOT338-R1) - A...
IoT Microcontrollers and Getting Started with Amazon FreeRTOS (IOT338-R1) - A...IoT Microcontrollers and Getting Started with Amazon FreeRTOS (IOT338-R1) - A...
IoT Microcontrollers and Getting Started with Amazon FreeRTOS (IOT338-R1) - A...
 
Ensuring Project Success with SpiraTeam and Rapise from Inflectra pta - short
Ensuring Project Success with SpiraTeam and Rapise from Inflectra   pta - shortEnsuring Project Success with SpiraTeam and Rapise from Inflectra   pta - short
Ensuring Project Success with SpiraTeam and Rapise from Inflectra pta - short
 
Modern Application Delivery on AWS: the Red Hat Way
Modern Application Delivery on AWS: the Red Hat WayModern Application Delivery on AWS: the Red Hat Way
Modern Application Delivery on AWS: the Red Hat Way
 
Managing Connected Devices at Scale with AWS IoT Device Management, ft. Hudl ...
Managing Connected Devices at Scale with AWS IoT Device Management, ft. Hudl ...Managing Connected Devices at Scale with AWS IoT Device Management, ft. Hudl ...
Managing Connected Devices at Scale with AWS IoT Device Management, ft. Hudl ...
 
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
 
Websites go Serverless | AWS Floor28
Websites go Serverless | AWS Floor28Websites go Serverless | AWS Floor28
Websites go Serverless | AWS Floor28
 
Websites go Serverless - Floor28
Websites go Serverless - Floor28Websites go Serverless - Floor28
Websites go Serverless - Floor28
 
APIに関するセッション資料
APIに関するセッション資料APIに関するセッション資料
APIに関するセッション資料
 

Recently uploaded

Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 

Redux JavaScript Meetup - Talentica, Saturday, July 6, 2019

  • 1. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Beginner to advanced
  • 2. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux itemList: [ ] Component-2 Component-1 Component-3 Display Component Parent Component Child Components
  • 3. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux itemList: [ ] Component-2 Component-1 Component-3 Display Component {id: 1} Parent Component State Child Components
  • 4. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux itemList: [ {id: 1} ] Component-2 Component-1 Component-3 Display Component Parent Component State
  • 5. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux itemList: [ {id: 1} ] Component-2 Component-1 Component-3 Display Component {id: 2}
  • 6. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux itemList: [ {id: 1} , {id: 2} ] Component-2 Component-1 Component-3 Display Component
  • 7. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux Component-2 Component-1 Component-3 Display Component {id: 1} {uid: 3} {id: 2},itemList: [ {id: 1} , {id: 2} ]
  • 8. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux itemList: [ {id: 1} , {id: 2} , { uid: 3} ] Component-2 Component-1 Component-3 Display Component
  • 9. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux Component-2 Component-1 Component-3 Display Component {id: 1} {id: 2} , { uid: 3}itemList: [ {id: 1} , {id: 2} , { uid: 3} ]
  • 10. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Why Redux Component-2 Component-1 Component-3 Display Component itemList: [ {id: 1} , {id: 2} , { uid: 3} ]
  • 11. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Problems • Hard to identify component with wrong logic. • Need rework to see intermediate state of app. • What if 100s of component updating same complex data. • Passing data through long chain of nested components. • Problems due to data mutation takes hours to debug and then finally you realize the issue and you are like ….
  • 12. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store
  • 13. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Store • Store is nothing but simple javaScript object which holds application state/data. Store State
  • 14. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights • What is store state. • Single instance of store will be used throughout application.
  • 15. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store
  • 16. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store Action1
  • 17. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Action
  • 18. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store Action1
  • 19. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store's state-1 Action1 Store's state1 Action1
  • 20. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store state-1 Action2 Store's state1 Action1
  • 21. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store's state-2 Action2 Store's state1 Action1 Store's state2 Action2
  • 22. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store's state-2 Action3 Store's state1 Action1 Store's state2 Action2
  • 23. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux Component-2 Component-1 Component-3 Display Component Store's state-3 Action3 Store's state1 Action1 Store's state2 Action2 Store's state3 Action3
  • 24. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Reducer • Reducer is just a function which understands action that components raise or dispatches. • It is responsible for taking out payload/data from action and appropriately storing it in redux store. • You will write actions as well as reducer 24
  • 25. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Redux data flow 25 Credits: Medium.com
  • 26. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Demo ... Vanilla Redux
  • 27. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Any Questions
  • 28. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights You might not need redux ...
  • 29. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights React Redux • Connect api helps application to connect with redux store. • It creates wrapper component around our component • It avoids some grunt work – like subscribing to store in each component. – Import store and passing dispatch to every component – Optimization to avoid unnecessary re-renders when store changes.
  • 30. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Demo ... React Redux
  • 31. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Connect api code
  • 32. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Cross Slice Reducer …
  • 33. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
  • 34. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Multiple stores
  • 35. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Normalized Store
  • 36. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Normalized Store
  • 37. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Chrome Plugin Demo ...
  • 38. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Replace Reducer
  • 39. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Replace Reducer
  • 40. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Hot reloading for faster development
  • 41. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Preloaded state
  • 42. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights
  • 43. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Most Important, Interesting and Easy part of Redux.
  • 44. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Middleware Credits: tenor.com
  • 45. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Let's see how middleware works. Syntax is available on docs as well.
  • 46. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Component dispatches action Middleware 1 Middleware 2 Middleware 3 Reducer Action Action Action Action
  • 47. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Demo ...
  • 48. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights Thunk Middleware
  • 49. Copyright © 2018 Talentica Software (I) Pvt Ltd. All rightsCopyright © 2018 Talentica Software (I) Pvt Ltd. All rights