際際滷

際際滷Share a Scribd company logo
REDUX
BY DAN JIPA, TEAM LEADER SOFTVISION
a predictable state container for JavaScript apps
The need
Managing state in big applications is too complicated.
REDUX By Dan Jipa [dan.jipa@gmail.com]
There is no separation of concerns.
Simpli鍖ed debugging.
! Single Source of Truth
Traditional communication between components
By Dan Jipa [dan.jipa@gmail.com]REDUX
1. Props
2. Callback functions
3. Event bubbling
4. Parent component
5. Observer pattern (publish,subscribe)
6. Global vars
1 2, 3 4 5, 6, 7
7. Context
Image: http://andrewhfarmer.com/component-communication/
Traditional data fetching
By Dan Jipa [dan.jipa@gmail.com]REDUX
1. Root component
2. Container component
By Dan Jipa [dan.jipa@gmail.com]
What do we need to start using Redux with React?
REDUX
Webpack (optional)
Babel (optional)
Redux
React - Redux
Middleware (Redux Thunk)
Request library (Fetch, Axios etc)
By Dan Jipa [dan.jipa@gmail.com]
Redux in a few words
REDUX
Store = {global application state}; dispatch()
Actions <User, Browser, Server> = the only way to change state
Reducers = mapping actions in state updates
connect() = sending data to low level components via props
high level/container components = components with access to global store
By Dan Jipa [dan.jipa@gmail.com]
Updating our state
REDUX
CURRENT STATE
Action
REDUCER NEW STATE
By Dan Jipa [dan.jipa@gmail.com]
Fetching data with Redux
REDUX
import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk';
import rootReducer from '../reducers'
export default function con鍖gureStore(initialState) {
const store = createStore(rootReducer, initialState, applyMiddleware(thunk)
);
return store
}
Creating our initial store
Modifying it using actions
export function translate(text, target) {
return dispatch => {
return fetch('https://www.googleapis.com/language/translate/v2?key='+API_KEY+'&source=en&target='+target+'&q='+ text) 
.then(response => response.json())
.then(response => dispatch(receiveTranslation(text, target, response.data.translations[0].translatedText)))
}
}
By Dan Jipa [dan.jipa@gmail.com]
LEARN REDUX
REDUX
How to manage request state with React & Redux
Redux - of鍖cial docs
A cartoon intro to Redux
Getting started with Redux - Video lectures by Dan Abramov
React - Redux - Udemy course (PAID)
By Dan Jipa [dan.jipa@gmail.com]
fb: dan.jipa,
tw: danjipa,
dan.jipa@gmail.com
Thank you!
Lets stay in touch
REDUX
Ad

Recommended

Completing the Microservices Puzzle: Kubernetes, Prometheus and FreshTracks.io
Completing the Microservices Puzzle: Kubernetes, Prometheus and FreshTracks.io
CA Technologies
旅隆略虜凌僚留 了凌粒凌竜僚溜留
旅隆略虜凌僚留 了凌粒凌竜僚溜留
Theresa Giakoumatou
Building our Component Library
Building our Component Library
Clement Ho
7 Redux challenges
7 Redux challenges
reactima
A Practical Approach to React Native at All Things Open Conference
A Practical Approach to React Native at All Things Open Conference
Tracy Lee
JOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and Redux
Jordan Open Source Association
Angular + JHipster - JHipster Conf
Angular + JHipster - JHipster Conf
William Marques
Better web apps with React and Redux
Better web apps with React and Redux
Ali Sa'o
Rich Ajax Platform - theEdge 2012 conference presentation
Rich Ajax Platform - theEdge 2012 conference presentation
Nicko Borodachuk
Case study on FishHub.org
Case study on FishHub.org
epoint Romania
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with Kubernetes
Nicola Ferraro
Lviv MD Day 2015 于舒仆 舒于于 "Mobile development with React Native"
Lviv MD Day 2015 于舒仆 舒于于 "Mobile development with React Native"
Lviv Startup Club
DavidWible_res
DavidWible_res
david wible
React Native - Getting Started
React Native - Getting Started
Tracy Lee
O365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - Material
Thomas Daly
Gophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in Go
AJ Bahnken
Drupal Extreme Scaling
Drupal Extreme Scaling
zekivazquez
React / Redux Architectures
React / Redux Architectures
Vin鱈cius Ribeiro
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
Tomcat & JBoss Replay Feature
Tomcat & JBoss Replay Feature
kilroy440
HugNov14
HugNov14
Adam Faris
There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014
jbandi
Modern web app with REACT
Modern web app with REACT
AndryRajohnson
Docker DevTools: Docker as part of your development toolset
Docker DevTools: Docker as part of your development toolset
Will Hall
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
Andres Almiray
Usability in the GeoWeb
Usability in the GeoWeb
Dave Bouwman
Universal React apps in Next.js
Universal React apps in Next.js
ukasz Ostrowski
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.

More Related Content

Similar to Using Redux with React (20)

Rich Ajax Platform - theEdge 2012 conference presentation
Rich Ajax Platform - theEdge 2012 conference presentation
Nicko Borodachuk
Case study on FishHub.org
Case study on FishHub.org
epoint Romania
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with Kubernetes
Nicola Ferraro
Lviv MD Day 2015 于舒仆 舒于于 "Mobile development with React Native"
Lviv MD Day 2015 于舒仆 舒于于 "Mobile development with React Native"
Lviv Startup Club
DavidWible_res
DavidWible_res
david wible
React Native - Getting Started
React Native - Getting Started
Tracy Lee
O365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - Material
Thomas Daly
Gophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in Go
AJ Bahnken
Drupal Extreme Scaling
Drupal Extreme Scaling
zekivazquez
React / Redux Architectures
React / Redux Architectures
Vin鱈cius Ribeiro
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
Tomcat & JBoss Replay Feature
Tomcat & JBoss Replay Feature
kilroy440
HugNov14
HugNov14
Adam Faris
There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014
jbandi
Modern web app with REACT
Modern web app with REACT
AndryRajohnson
Docker DevTools: Docker as part of your development toolset
Docker DevTools: Docker as part of your development toolset
Will Hall
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
Andres Almiray
Usability in the GeoWeb
Usability in the GeoWeb
Dave Bouwman
Universal React apps in Next.js
Universal React apps in Next.js
ukasz Ostrowski
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
Rich Ajax Platform - theEdge 2012 conference presentation
Rich Ajax Platform - theEdge 2012 conference presentation
Nicko Borodachuk
Case study on FishHub.org
Case study on FishHub.org
epoint Romania
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with Kubernetes
Nicola Ferraro
Lviv MD Day 2015 于舒仆 舒于于 "Mobile development with React Native"
Lviv MD Day 2015 于舒仆 舒于于 "Mobile development with React Native"
Lviv Startup Club
DavidWible_res
DavidWible_res
david wible
React Native - Getting Started
React Native - Getting Started
Tracy Lee
O365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - Material
Thomas Daly
Gophers Riding Elephants: Writing PostgreSQL tools in Go
Gophers Riding Elephants: Writing PostgreSQL tools in Go
AJ Bahnken
Drupal Extreme Scaling
Drupal Extreme Scaling
zekivazquez
React / Redux Architectures
React / Redux Architectures
Vin鱈cius Ribeiro
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
Tomcat & JBoss Replay Feature
Tomcat & JBoss Replay Feature
kilroy440
There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014
jbandi
Modern web app with REACT
Modern web app with REACT
AndryRajohnson
Docker DevTools: Docker as part of your development toolset
Docker DevTools: Docker as part of your development toolset
Will Hall
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
Andres Almiray
Usability in the GeoWeb
Usability in the GeoWeb
Dave Bouwman
Universal React apps in Next.js
Universal React apps in Next.js
ukasz Ostrowski
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA

Recently uploaded (20)

FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Josef Weingand
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Josef Weingand
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
Ad

Using Redux with React

  • 1. REDUX BY DAN JIPA, TEAM LEADER SOFTVISION a predictable state container for JavaScript apps
  • 2. The need Managing state in big applications is too complicated. REDUX By Dan Jipa [dan.jipa@gmail.com] There is no separation of concerns. Simpli鍖ed debugging. ! Single Source of Truth
  • 3. Traditional communication between components By Dan Jipa [dan.jipa@gmail.com]REDUX 1. Props 2. Callback functions 3. Event bubbling 4. Parent component 5. Observer pattern (publish,subscribe) 6. Global vars 1 2, 3 4 5, 6, 7 7. Context Image: http://andrewhfarmer.com/component-communication/
  • 4. Traditional data fetching By Dan Jipa [dan.jipa@gmail.com]REDUX 1. Root component 2. Container component
  • 5. By Dan Jipa [dan.jipa@gmail.com] What do we need to start using Redux with React? REDUX Webpack (optional) Babel (optional) Redux React - Redux Middleware (Redux Thunk) Request library (Fetch, Axios etc)
  • 6. By Dan Jipa [dan.jipa@gmail.com] Redux in a few words REDUX Store = {global application state}; dispatch() Actions <User, Browser, Server> = the only way to change state Reducers = mapping actions in state updates connect() = sending data to low level components via props high level/container components = components with access to global store
  • 7. By Dan Jipa [dan.jipa@gmail.com] Updating our state REDUX CURRENT STATE Action REDUCER NEW STATE
  • 8. By Dan Jipa [dan.jipa@gmail.com] Fetching data with Redux REDUX import { createStore, applyMiddleware } from 'redux' import thunk from 'redux-thunk'; import rootReducer from '../reducers' export default function con鍖gureStore(initialState) { const store = createStore(rootReducer, initialState, applyMiddleware(thunk) ); return store } Creating our initial store Modifying it using actions export function translate(text, target) { return dispatch => { return fetch('https://www.googleapis.com/language/translate/v2?key='+API_KEY+'&source=en&target='+target+'&q='+ text) .then(response => response.json()) .then(response => dispatch(receiveTranslation(text, target, response.data.translations[0].translatedText))) } }
  • 9. By Dan Jipa [dan.jipa@gmail.com] LEARN REDUX REDUX How to manage request state with React & Redux Redux - of鍖cial docs A cartoon intro to Redux Getting started with Redux - Video lectures by Dan Abramov React - Redux - Udemy course (PAID)
  • 10. By Dan Jipa [dan.jipa@gmail.com] fb: dan.jipa, tw: danjipa, dan.jipa@gmail.com Thank you! Lets stay in touch REDUX