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 has 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
JOSA TechTalks - 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
JOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - 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

More Related Content

PDF
Building Modern Web Applications using React and Redux
PDF
JOSA TechTalks - RESTful API Concepts and Best Practices
PPTX
Reactjs
PDF
Getting Started with React-Nathan Smith
PPTX
React JS: A Secret Preview
PPTX
Introduction to React
PPTX
React js - The Core Concepts
PPTX
React js
Building Modern Web Applications using React and Redux
JOSA TechTalks - RESTful API Concepts and Best Practices
Reactjs
Getting Started with React-Nathan Smith
React JS: A Secret Preview
Introduction to React
React js - The Core Concepts
React js

What's hot (20)

PPTX
React js programming concept
PDF
An Overview of the React Ecosystem
PPTX
React js basics
PPTX
React js Rahil Memon
PDF
React js
PPSX
React introduction
PPTX
React JS part 1
PDF
Introduction to react
PDF
learn what React JS is & why we should use React JS .
PPTX
React js
PDF
React and redux
PPTX
Better web apps with React and Redux
PPTX
PPTX
Its time to React.js
PDF
ReactJS presentation
PPTX
React js Online Training
PPTX
learn what React JS is & why we should use React JS .
PPTX
reactJS
PPTX
[Final] ReactJS presentation
PPTX
React.js - The Dawn of Virtual DOM
React js programming concept
An Overview of the React Ecosystem
React js basics
React js Rahil Memon
React js
React introduction
React JS part 1
Introduction to react
learn what React JS is & why we should use React JS .
React js
React and redux
Better web apps with React and Redux
Its time to React.js
ReactJS presentation
React js Online Training
learn what React JS is & why we should use React JS .
reactJS
[Final] ReactJS presentation
React.js - The Dawn of Virtual DOM
Ad

Similar to JOSA TechTalks - Better Web Apps with React and Redux (20)

PPTX
React & redux
PDF
Learning React js Learn React JS From Scratch with Hands On Projects 2nd Edit...
PPTX
React JS - A quick introduction tutorial
PDF
Content-Driven Apps with React
PDF
The Road To Redux
PDF
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
PDF
React In Action 1st Edition Mark Tielens Thomas
PPTX
theory-slides-for react for beginners.pptx
PPTX
React gsg presentation with ryan jung & elias malik
PPTX
React.js at Cortex
PDF
An Intense Overview of the React Ecosystem
PPTX
PDF
React in Action ( PDFDrive ).pdf
PPTX
Introduction to react and redux
PPTX
Reactjs notes.pptx for web development- tutorial and theory
PPTX
Reactjs A javascript Library
PPTX
Academy PRO: React JS. Redux & Tooling
PDF
PDF
#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux
PPTX
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React & redux
Learning React js Learn React JS From Scratch with Hands On Projects 2nd Edit...
React JS - A quick introduction tutorial
Content-Driven Apps with React
The Road To Redux
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
React In Action 1st Edition Mark Tielens Thomas
theory-slides-for react for beginners.pptx
React gsg presentation with ryan jung & elias malik
React.js at Cortex
An Intense Overview of the React Ecosystem
React in Action ( PDFDrive ).pdf
Introduction to react and redux
Reactjs notes.pptx for web development- tutorial and theory
Reactjs A javascript Library
Academy PRO: React JS. Redux & Tooling
#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Ad

More from Jordan Open Source Association (20)

PPTX
JOSA TechTalks - Data Oriented Architecture
PPTX
JOSA TechTalks - Machine Learning on Graph-Structured Data
PDF
OpenSooq Mobile Infrastructure @ Scale
PDF
Data-Driven Digital Transformation
PDF
Data Science in Action
PDF
Processing Arabic Text
PDF
JOSA TechTalks - Downgrade your Costs
PDF
JOSA TechTalks - Docker in Production
PPTX
JOSA TechTalks - Word Embedding and Word2Vec Explained
PDF
Web app architecture
PDF
Intro to the Principles of Graphic Design
ODP
Intro to Graphic Design Elements
PDF
JOSA TechTalk: Realtime monitoring and alerts
PPTX
JOSA TechTalk: Metadata Management
in Big Data
ODP
JOSA TechTalk: Introduction to Supervised Learning
PDF
JOSA TechTalk: Taking Docker to Production
PDF
JOSA TechTalk: Introduction to docker
PDF
D programming language
PDF
A taste of Functional Programming
PDF
JOSA TechTalks - Machine Learning in Practice
JOSA TechTalks - Data Oriented Architecture
JOSA TechTalks - Machine Learning on Graph-Structured Data
OpenSooq Mobile Infrastructure @ Scale
Data-Driven Digital Transformation
Data Science in Action
Processing Arabic Text
JOSA TechTalks - Downgrade your Costs
JOSA TechTalks - Docker in Production
JOSA TechTalks - Word Embedding and Word2Vec Explained
Web app architecture
Intro to the Principles of Graphic Design
Intro to Graphic Design Elements
JOSA TechTalk: Realtime monitoring and alerts
JOSA TechTalk: Metadata Management
in Big Data
JOSA TechTalk: Introduction to Supervised Learning
JOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Introduction to docker
D programming language
A taste of Functional Programming
JOSA TechTalks - Machine Learning in Practice

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Electronic commerce courselecture one. Pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Unlocking AI with Model Context Protocol (MCP)
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Building Integrated photovoltaic BIPV_UPV.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Electronic commerce courselecture one. Pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
Empathic Computing: Creating Shared Understanding
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
The Rise and Fall of 3GPP – Time for a Sabbatical?
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Weekly Chronicles - August'25 Week I
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation theory and applications.pdf
Spectral efficient network and resource selection model in 5G networks
Digital-Transformation-Roadmap-for-Companies.pptx

JOSA TechTalks - Better Web Apps with React and Redux