SlideShare a Scribd company logo
MANAGE THE FLUX OF
YOUR WEB APPLICATION:
LET’S REDUX
Redux
Ego Slide
f.strazzullo@extrategy.net
@TheStrazz86
https://github.com/francesco-strazzullo
https://medium.com/@TheStrazz86
https://slides.com/francescostrazzullo
http://codingjam.it/
https://taskomat.tech/it/
State Management
React
“ A JavaScript library for
building user interfaces
Manage the Flux of your Web Application: Let's Redux
class HelloMessage extends React.Component {
render() {
return <div>Hello {this.props.name}!</div>;
}
}
ReactDOM.render(<HelloMessage name="World" />, mountNode);
So Basically...it's not a
framework
Features
Components
JSX
class HelloMessage extends React.Component {
render() {
return React.createElement(
"div",
null,
"Hello ",
this.props.name
);
}
}
ReactDOM.render(React.createElement(HelloMessage, { name: "World" }), mountNode);
Virtual Dom
State
class Timer extends React.Component {
constructor(props) {
super(props);
this.state = {secondsElapsed: 0};
}
tick() {
this.setState((prevState) => ({
secondsElapsed: prevState.secondsElapsed + 1
}));
}
componentDidMount() {
this.interval = setInterval(() => this.tick(), 1000);
}
componentWillUnmount() {
clearInterval(this.interval);
}
render() {
return (
<div>Seconds Elapsed: {this.state.secondsElapsed}</div>
);
}
}
ReactDOM.render(<Timer />, mountNode);
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
Flux
“ Application Architecture For
Building User Interfaces
Why Not MVC?
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
Action: an event fired in the
system with the purpose to
change its state
Dispatcher: an event bus to
send actions into the system
Store: business logic objects.
Just like the M in MVC
View: React Components
Manage the Flux of your Web Application: Let's Redux
Why Flux?
One Way of Thinking
Constant complexity on big
projects
Redux
“ Redux is a predictable state
container for JavaScript apps
Why not Flux?
One Way of Thinking (Really?)
Principles
"Single source of truth"
The state of your whole application is stored in
an object tree inside a single store.
"State is read-only"
The only way to mutate the state is to emit an
action, an object describing what happened.
"Mutations are written
as pure functions"
To specify how the state tree is transformed by
actions, you write pure reducers.
Elements
Actions
import Dispatcher from "src/Dispatcher";
var add = function(text) {
Dispatcher.dispatch({
actionType: "addTodo",
text: text
});
};
var add = function(text) {
return {
actionType: "addTodo",
text: text
};
};
Flux Redux
Reducer
function addTodo(state,text){
var toReturn = Object.assign({},state,{
todos:[...state.todos]
});
toReturn.todos.push(text);
return toReturn;
};
Store + Dispatcher
import { createStore } from 'redux';
import Reducers from 'src/Reducers';
let store = createStore(Reducers);
Container Components
Presentational Components
Why Redux?
One Way of Thinking (Really
this time)
Serilizable State
No side-effect
No Technical Debt
Manage the Flux of your Web Application: Let's Redux
Async Actions
onClick() {
this.props.dispatch(actions.requestData())
this.api.list().then(response => {
this.props.dispatch(actions.requestDataSuccess(response.data))
}).catch(error => {
this.props.dispatch(actions.requestDataError(error))
})
}
redux-saga
“ A Saga is an independent
component that reacts to
domain events in a cross-
aggregate, eventually
consistent manner.
“ redux-saga is a library that
aims to make side effects in
Redux applications easier and
better.
function* fetch() {
try {
const data = yield call(api.list);
yield put(actions.requestDataSuccess(data));
} catch (e) {
yield put(actions.requestDataError(e));
}
}
function* mySaga() {
yield takeLatest("REQUEST_DATA", fetch);
}
export default mySaga;
Manage the Flux of your Web Application: Let's Redux
That's It!
f.strazzullo@e-xtrategy.net
@TheStrazz86
https://github.com/e-xtrategy/javascript-course/
Thanks!

More Related Content

What's hot (20)

PDF
React + Redux. Best practices
Clickky
 
PPTX
React и redux
Дмитрий Радыно
 
PDF
React, Redux, ES2015 by Max Petruck
Maksym Petruk
 
PDF
Designing applications with Redux
Fernando Daciuk
 
PDF
Introduction to Redux
Ignacio Martín
 
PDF
Switch to React.js from AngularJS developer
Eugene Zharkov
 
PDF
State Models for React with Redux
Stephan Schmidt
 
PDF
React.js or why DOM finally makes sense
Eldar Djafarov
 
PDF
Angular redux
Nir Kaufman
 
PDF
Let's discover React and Redux with TypeScript
Mathieu Savy
 
PPTX
Better React state management with Redux
Maurice De Beijer [MVP]
 
PDF
Workshop 20: ReactJS Part II Flux Pattern & Redux
Visual Engineering
 
PPTX
React + Redux + TypeScript === ♥
Remo Jansen
 
PDF
React lecture
Christoffer Noring
 
PPTX
ProvJS: Six Months of ReactJS and Redux
Thom Nichols
 
PDF
Introduction to React & Redux
Boris Dinkevich
 
PDF
React Lifecycle and Reconciliation
Zhihao Li
 
PDF
Advanced redux
Boris Dinkevich
 
PDF
Using React, Redux and Saga with Lottoland APIs
Mihail Gaberov
 
PDF
Creating a WYSIWYG Editor with React
peychevi
 
React + Redux. Best practices
Clickky
 
React, Redux, ES2015 by Max Petruck
Maksym Petruk
 
Designing applications with Redux
Fernando Daciuk
 
Introduction to Redux
Ignacio Martín
 
Switch to React.js from AngularJS developer
Eugene Zharkov
 
State Models for React with Redux
Stephan Schmidt
 
React.js or why DOM finally makes sense
Eldar Djafarov
 
Angular redux
Nir Kaufman
 
Let's discover React and Redux with TypeScript
Mathieu Savy
 
Better React state management with Redux
Maurice De Beijer [MVP]
 
Workshop 20: ReactJS Part II Flux Pattern & Redux
Visual Engineering
 
React + Redux + TypeScript === ♥
Remo Jansen
 
React lecture
Christoffer Noring
 
ProvJS: Six Months of ReactJS and Redux
Thom Nichols
 
Introduction to React & Redux
Boris Dinkevich
 
React Lifecycle and Reconciliation
Zhihao Li
 
Advanced redux
Boris Dinkevich
 
Using React, Redux and Saga with Lottoland APIs
Mihail Gaberov
 
Creating a WYSIWYG Editor with React
peychevi
 

Similar to Manage the Flux of your Web Application: Let's Redux (20)

PDF
[@NaukriEngineering] Flux Architecture
Naukri.com
 
PPTX
React. Flux. Redux
Andrey Kolodnitsky
 
PPTX
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
PPTX
React. Flux. Redux. by Andrey Kolodnitskiy
Valeriia Maliarenko
 
PDF
The Road To Redux
Jeffrey Sanchez
 
PPTX
Reducers+flux=redux
Shmulik Chicvashvili
 
PDF
Reactивная тяга
Vitebsk Miniq
 
PDF
Redux essentials
Chandan Kumar Rana
 
PDF
Getting started with React and Redux
Paddy Lock
 
PDF
An Introduction to Redux
NexThoughts Technologies
 
PPTX
React gsg presentation with ryan jung &amp; elias malik
Lama K Banna
 
PDF
Building React Applications with Redux
FITC
 
PDF
Flux architecture and Redux - theory, context and practice
Jakub Kocikowski
 
PPTX
ReactJS
Fatih Şimşek
 
PPTX
React + Flux = Joy
John Need
 
PDF
React & ES6 Intro
Yair Aviner
 
PDF
Redux for ReactJS Programmers
David Rodenas
 
PDF
Григорий Шехет "Treasure hunt in the land of Reactive frameworks"
Fwdays
 
PPTX
React, Flux and a little bit of Redux
Ny Fanilo Andrianjafy, B.Eng.
 
[@NaukriEngineering] Flux Architecture
Naukri.com
 
React. Flux. Redux
Andrey Kolodnitsky
 
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
React. Flux. Redux. by Andrey Kolodnitskiy
Valeriia Maliarenko
 
The Road To Redux
Jeffrey Sanchez
 
Reducers+flux=redux
Shmulik Chicvashvili
 
Reactивная тяга
Vitebsk Miniq
 
Redux essentials
Chandan Kumar Rana
 
Getting started with React and Redux
Paddy Lock
 
An Introduction to Redux
NexThoughts Technologies
 
React gsg presentation with ryan jung &amp; elias malik
Lama K Banna
 
Building React Applications with Redux
FITC
 
Flux architecture and Redux - theory, context and practice
Jakub Kocikowski
 
React + Flux = Joy
John Need
 
React & ES6 Intro
Yair Aviner
 
Redux for ReactJS Programmers
David Rodenas
 
Григорий Шехет "Treasure hunt in the land of Reactive frameworks"
Fwdays
 
React, Flux and a little bit of Redux
Ny Fanilo Andrianjafy, B.Eng.
 
Ad

More from Commit University (20)

PDF
Accessibilità ed equità digitale: un impegno, non una scelta
Commit University
 
PDF
GitHub Copilot:vediamo chi comanda - Commit University.pdf
Commit University
 
PDF
Contract Driven Development - Branch 2024.pdf
Commit University
 
PPTX
Cybersecurity & AI: Illusioni e Speranze
Commit University
 
PDF
Migliorare la Developer Experience in un mondo Cloud Native
Commit University
 
PPTX
Scopri come sfruttare la potenza della Hybrid RAG
Commit University
 
PDF
Introduzione a AWS Forecast e SageMaker DeepAR: Prevedere la Domanda con il M...
Commit University
 
PDF
Oltre l'hype: vulnerabilità e limiti dell'intelligenza artificiale.pdf
Commit University
 
PPTX
Alla scoperta dei Vector Database e dei RAG
Commit University
 
PDF
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
 
PDF
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Commit University
 
PDF
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdf
Commit University
 
PDF
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdf
Commit University
 
PDF
Slide-10years.pdf
Commit University
 
PDF
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...
Commit University
 
PDF
Vue.js slots.pdf
Commit University
 
PPTX
Commit - Qwik il framework che ti stupirà.pptx
Commit University
 
PPTX
Sviluppare da zero una Angular Web App per la PA
Commit University
 
PDF
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Commit University
 
PDF
Prisma the ORM that node was waiting for
Commit University
 
Accessibilità ed equità digitale: un impegno, non una scelta
Commit University
 
GitHub Copilot:vediamo chi comanda - Commit University.pdf
Commit University
 
Contract Driven Development - Branch 2024.pdf
Commit University
 
Cybersecurity & AI: Illusioni e Speranze
Commit University
 
Migliorare la Developer Experience in un mondo Cloud Native
Commit University
 
Scopri come sfruttare la potenza della Hybrid RAG
Commit University
 
Introduzione a AWS Forecast e SageMaker DeepAR: Prevedere la Domanda con il M...
Commit University
 
Oltre l'hype: vulnerabilità e limiti dell'intelligenza artificiale.pdf
Commit University
 
Alla scoperta dei Vector Database e dei RAG
Commit University
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Commit University
 
Breaking REST Chains_ A Fastify & Mercurius Pathway to GraphQL Glory.pdf
Commit University
 
Accelerating API Development: A Pit Stop with Gin-Gonic in Golang-Slide.pdf
Commit University
 
Slide-10years.pdf
Commit University
 
Collaborazione, Decisionalità e Gestione della Complessità nel Tempo: cosa ...
Commit University
 
Vue.js slots.pdf
Commit University
 
Commit - Qwik il framework che ti stupirà.pptx
Commit University
 
Sviluppare da zero una Angular Web App per la PA
Commit University
 
Backstage l'Internal Developer Portal Open Source per una migliore Developer ...
Commit University
 
Prisma the ORM that node was waiting for
Commit University
 
Ad

Recently uploaded (20)

PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 

Manage the Flux of your Web Application: Let's Redux