SlideShare a Scribd company logo
Better Web Apps with React
& Redux
Improve your web apps with
React
Ali Al-Sa’o
About Me
Ali Hussein Al-Sa’o
Senior Front End Engineer @MBC group
10+ years in web development
alsao ali-sao ali_sao
What is React
React is a UI library developed at Facebook to facilitate the
creation of interactive, stateful & reusable UI components. It is
used at Facebook in production, and Instagram.com is written
entirely in React.
One of it's unique selling points is that not only does it perform on
the client side, but it can also be rendered server side
(Isomorphic).
It also uses a concept called the Virtual DOM that selectively
renders subtrees of nodes based upon state changes. It does the
least amount of DOM manipulation possible in order to keep your
components up to date.
What does it need to make
it work and why
A typical modern React project needs the following to run
productively and successfully
Babel : babel is a javascript transpiler that converts code from
one syntax to another. Mainly responsible for converting JSX and
ES6 into valid ES5 all browsers can understand
Webpack : A javascript bundler and task runner. You can uglify
your code, deploy to live server , import assets as modules , lint
and test your code , compile css preprocessors and tons of other
tasks.
What special about React
Let’s try to clone Facebook messenger using my React
And your old fatty jQuery
React is all about components
With React we can build reusable components that would allow
us to share code all over our project
Components have data
containers
Components can receive data via props.
Components has inner state object.
Data flow is unidirectional.
Data containers are separating concern.
Components have data
containers
Components have
Lifecycle Hooks
Do something at a certain lifecycle time
Mounting hooks :
• componentWillMount()
• render()
• componentDidMount()
Updating hooks :
• componentDidUpdate()
Unmounting
• componentWillUnmount()
What about this
Really , what about this?
React will do the magic for you
With jQuery you have to re-render the whole list
Virtual DOM VS DOM
manipulation
How VDOM works
React is Functional
Do one single thing at a time without side effects
React is super easy to debug
Thanks to React developer tools
React unit testing is heaven
Declarative = Predictable
React is Universal
write once, run anywhere.
React Native
React VR
One more thing…
‫اللي‬‫سرق‬‫القداحه‬‫يرجعها‬
Questions?
Scaling React Apps With
Redux
Omar Abdelhafith
About Me
Omar Abdelhafith
Staff Software Engineer @Zendesk
iOS/Android and Backend
nsomar nsomar @ifnottrue
http://nsomar.com
Recap…
Chat
Component
Messages
Component
Recap…
Recap…
Recap…
Structure
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Structure - State
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Messages
Selected
Main State
Text Field State
Structure - State
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Messages State Chat State
Text Field StateBody State
Header State
Singleton
Other Singleton
Structure - Actions
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Complexity grows with
State
We gonna talk about 3
issues
Issue 1
Scalability
Adding more components
UserInfo
Component
GifChooser
Component
Scaling
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
UserInfo
Component
Gif
Component
Adding more components
Adding more components
Adding GifChooser and UserInfo
- App.js state grows
- App.js action handling grows
Issue 2
Correctness
Updating the state
Chat
Web App
User Typing
Uploading
Images
Web Sockets
Messages
Web Sockets
Status and
updates
Async Http
requests
MQTT
Searching
Gifs
Searching
Gifs
Updating the state
- Real-life applications receive many events
- These events change the state
- Leads to incorrect UI updates
Example
Message Received
Message Updated
Message Deleted
Example - Off Order
Message Received
Message Updated
Message Deleted
Example
Correct Order Of Event Incorrect Order Of Event
Issue 3
Consistence
Consistence
Message Received
Reorder the
users
Add
Message
Here
Maybe
Other???
Issues so far
Scalability
Consistence
Correctness
Facebook tired to solve
these issues
Enter
Unidirectional data flow
architectures
Better web apps with React and Redux
Unidirectional architectures
Two popular architectures
- Flux
- Redux
Unidirectional architectures
Flux
Redux
We will focus on Redux
Redux
Redux - Flow
Redux - Connect
Chat
Component
Messages
Component
Non Redux Structure
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Non Redux Structure
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Redux Store
Our 3 issues
Scalability
Consistence
Correctness
Scalability?
Solved by connecting multiple views to a single
reducer!
Works for Actions and State
Our 3 issues
Scalability
Consistence
Correctness
Our 3 issues
Scalability
Consistence
Correctness
Redux - Action
Actions No Redux
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Actions With Redux
App
Component
Messages
Component
Chat
Component
Header
Component
Body
Component
Controls
Component
Redux Store
Redux - Reducer
Redux
Redux - Reducer
Redux - Reducer
Redux
Our 3 issues
Scalability
Consistence
Correctness
Consistence?
- State is only changed when actions are
dispatched
- Only the Reducer changes the state
- All connected views are notified
Our 3 issues
Scalability
Consistence
Correctness
Our 3 issues
Scalability
Consistence
Correctness
Correctness?
- Only the Reducer changes the state
- The Reduce function CANNOT be called twice
Our 3 issues
Scalability
Consistence
Correctness
Our 3 issues
Scalability
Consistence
Correctness
Almost done!
2 More things
First
Redux focuses on developer tooling and
happiness
Developer Happiness
Developer Happiness
2 More things
Second
Are you a Mobile Developer (iOS/Android)?
2 More things
Second
Are you a Mobile Developer (iOS/Android)?
We Got you covered!!
Suas
Suas also makes
developers happy
Better web apps with React and Redux
Better web apps with React and Redux
Excited? Head to
https://suas.readme.io
To Sum Up
React: State controls the view
Redux: State controls the app
Questions?
Thanks
Ad

Recommended

ReactJS presentation
ReactJS presentation
Thanh Tuong
 
React JS: A Secret Preview
React JS: A Secret Preview
valuebound
 
React js - The Core Concepts
React js - The Core Concepts
Divyang Bhambhani
 
Understanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree Technologies
Walking Tree Technologies
 
Introduction to react_js
Introduction to react_js
MicroPyramid .
 
Introduction to Redux
Introduction to Redux
Ignacio Martín
 
Its time to React.js
Its time to React.js
Ritesh Mehrotra
 
Introduction to ReactJS
Introduction to ReactJS
Knoldus Inc.
 
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
namespaceit
 
React and redux
React and redux
Mystic Coders, LLC
 
React + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
React js for beginners
React js for beginners
Alessandro Valenti
 
React hooks
React hooks
Ramy ElBasyouni
 
React hooks
React hooks
Sadhna Rana
 
React js programming concept
React js programming concept
Tariqul islam
 
reactJS
reactJS
Syam Santhosh
 
Introduction to React
Introduction to React
Rob Quick
 
A Brief Introduction to React.js
A Brief Introduction to React.js
Doug Neiner
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .
paradisetechsoftsolutions
 
Redux Toolkit - Quick Intro - 2022
Redux Toolkit - Quick Intro - 2022
Fabio Biondi
 
React JS part 1
React JS part 1
Diluka Wittahachchige
 
Introduction to react
Introduction to react
kiranabburi
 
Introduction to React JS for beginners
Introduction to React JS for beginners
Varun Raj
 
Intro to react native
Intro to react native
ModusJesus
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
React js
React js
Rajesh Kolla
 
React js
React js
Oswald Campesato
 
Learn react-js
Learn react-js
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 
JOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and Redux
Jordan Open Source Association
 
React & redux
React & redux
Cédric Hartland
 

More Related Content

What's hot (20)

Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
namespaceit
 
React and redux
React and redux
Mystic Coders, LLC
 
React + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
React js for beginners
React js for beginners
Alessandro Valenti
 
React hooks
React hooks
Ramy ElBasyouni
 
React hooks
React hooks
Sadhna Rana
 
React js programming concept
React js programming concept
Tariqul islam
 
reactJS
reactJS
Syam Santhosh
 
Introduction to React
Introduction to React
Rob Quick
 
A Brief Introduction to React.js
A Brief Introduction to React.js
Doug Neiner
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .
paradisetechsoftsolutions
 
Redux Toolkit - Quick Intro - 2022
Redux Toolkit - Quick Intro - 2022
Fabio Biondi
 
React JS part 1
React JS part 1
Diluka Wittahachchige
 
Introduction to react
Introduction to react
kiranabburi
 
Introduction to React JS for beginners
Introduction to React JS for beginners
Varun Raj
 
Intro to react native
Intro to react native
ModusJesus
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
React js
React js
Rajesh Kolla
 
React js
React js
Oswald Campesato
 
Learn react-js
Learn react-js
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 

Similar to Better web apps with React and Redux (20)

JOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and Redux
Jordan Open Source Association
 
React & redux
React & redux
Cédric Hartland
 
Content-Driven Apps with React
Content-Driven Apps with React
Netcetera
 
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
The Road To Redux
The Road To Redux
Jeffrey Sanchez
 
React In Action 1st Edition Mark Tielens Thomas
React In Action 1st Edition Mark Tielens Thomas
huulahlaji
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
Rami Sayar
 
ReactJS
ReactJS
Ram Murat Sharma
 
React.js at Cortex
React.js at Cortex
Geoff Harcourt
 
React gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
React in Action ( PDFDrive ).pdf
React in Action ( PDFDrive ).pdf
almako2
 
Introduction to react and redux
Introduction to react and redux
Cuong Ho
 
An Overview of the React Ecosystem
An Overview of the React Ecosystem
FITC
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 
React
React
Amitai Barnea
 
React introduction
React introduction
Kashyap Parmar
 
Welcome to React & Flux !
Welcome to React & Flux !
Ritesh Kumar
 
Content-Driven Apps with React
Content-Driven Apps with React
Netcetera
 
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
React In Action 1st Edition Mark Tielens Thomas
React In Action 1st Edition Mark Tielens Thomas
huulahlaji
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
Rami Sayar
 
React gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
React in Action ( PDFDrive ).pdf
React in Action ( PDFDrive ).pdf
almako2
 
Introduction to react and redux
Introduction to react and redux
Cuong Ho
 
An Overview of the React Ecosystem
An Overview of the React Ecosystem
FITC
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 
Welcome to React & Flux !
Welcome to React & Flux !
Ritesh Kumar
 
Ad

Recently uploaded (20)

10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
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
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
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
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Ad

Better web apps with React and Redux