SlideShare a Scribd company logo
BUILDING MODERN WEB
APPLICATIONS USING
REACT & REDUX
Maxime Najim
Thursday, May 18,
2018
WoW Tech Meetup
About Me
• Software architect and a full stack web
developer
• Over 12 years experience building
large, highly scalable and reliable web
applications for companies like
Yahoo!, Apple, Netflix, and Walmart
• Co-author of the O'Reilly Media book
entitled "Building Isomorphic
JavaScript Apps” and an upcoming
video series: “Universal JavaScript
with React, Node, and Redux”.
Publications
Sr. Software Architect

Walmart Global eCommerce
September 2016
August 2017
Building Modern Web
Applications using
React & Redux
Building Modern Web
Applications using
React & Redux
https://www.uber.com/ https://mobile.twitter.com
Modern Web Applications
Modern Web Applications
Unified View of the Current State
Cart State
Filter State
Button State
Action - Add to Cart
Action - Add to Cart
Action - Add to Cart
State 1 State 2 State 3 State N
Action 1 Action 2 Action N
Action - Add to Cart
Old State New State
Action
The Problem of Modern Web Applications
As an application grows it becomes harder to determine the overall state of the
application and cumbersome to understand where updates are coming from.
The Anatomy of a Client Application
Data View
Web App
Events
• Data: Server Data and Input
• Display: A visual representation of the
data
• Event Handlers: User interactions
The Anatomy of a Client Application
Redux View
Web App
Events
• Data: Server Data and Input
• Display: A visual representation of the
data
• Event Handlers: User interactions
The Anatomy of a Client Application
Redux React
Web App
Events
• Data: Server Data and Input
• Display: A visual representation of the
data
• Event Handlers: User interactions
Building Modern Web
Applications using
React & Redux
Redux - 

Basic Flow
• Uni-directional data flow
• Immutable single store
• Action object describing
what happened.
• All state updates are
performed by pure
functions
ref: http://slides.com/jenyaterpil/redux-from-twitter-hype-to-production#/9
(state, action) => state
Redux - 

Basic Flow
• An action is dispatched
(often in response to user
interaction).
• The root reducer function is
called with the current state
and the dispatched action.
• It then returns the new
state.
• React app retrieves the
updated state and re-renders
(state, action) => state
Action
Event
Redux - 

Basic Flow
• An action is dispatched
(often in response to user
interaction).
• The root reducer function is
called with the current state
and the dispatched action.
• It then returns the new
state.
• React app retrieves the
updated state and re-renders
(state, action) => state
State
Action
Redux - 

Basic Flow
• An action is dispatched
(often in response to user
interaction).
• The root reducer function is
called with the current state
and the dispatched action.
• It then returns the new
state.
• View retrieves the updated
state and re-renders
(state, action) => state
State
Redux - 

Actions
Redux - 

Reducer
Redux - 

Store
Local unified copy of distributed data
Redux - 

Async Flow
• Action creator can
have logic for
communicating with
backend APIs
• Middleware provides
third-party extension
point that can be
added to redux
Redux Side Effects
Async Action Creator - API Call
actions.js
Redux - 

Async Flow
• An event in the UI
causes and action
created to be invoked
Redux - 

Async Flow
• An event in the UI
causes and action
created to be invoked
• A function is returned
by the action creator
Redux - 

Async Flow
• An event in the UI
causes and action
created to be invoked
• A function is returned
by the action creator
• Middleware calls the
function
Redux - 

Async Flow
• Dispatches a “Request
Started” action and
calls the API.
Redux - 

Async Flow
• Dispatches a “Request
Started” action and
calls the API.
• Once a response is
returned from the API
call.
Redux - 

Async Flow
• Dispatch a “Request
Started” action and
call the API
• A response is returned
from the API call
• Dispatch a “Request
Succeeded” action
Redux - 

Async Flow
• Dispatch a “Request
Started” action and
call the API
• A response is returned
from the API call
• Dispatch a “Request
Succeeded” action
Building Modern Web
Applications using
React & Redux
Redux - 

Async Flow
• Dispatch a “Request
Started” action and
call the API
• A response is returned
from the API call
• Dispatch a “Request
Succeeded” action
Redux - 

Async Flow
• Dispatch a “Request
Started” action and
call the API
• A response is returned
from the API call
• Dispatch a “Request
Succeeded” action
Web Browser
Rendering
Engine 



(HTML, CSS)
Scripting Engine
(JavaScript)
Browser
APIs
(Document,
Window,
Navigator)
HTML DOM createElement()
client/App.js
Web Browser
Rendering
Engine 



(HTML, CSS)
Scripting Engine
Browser
APIs
(Document,
Window,
Navigator)
React.js
Components
Data
Virtual DOM
minimal set of

real DOM 

mutations
React - Hello World
client/App.jsx
React - Hello World
client/App.jsx
React - Hello World
client/App.jsx
React - Hello World
client/index.jsx
React - Smart Greeting (JSX)
client/App.jsx
React - Clickable Image
client/ClickableImage.jsx
React - Clickable Image
client/App.jsx
React - Product Grid
client/App.jsx
React - Product Component
client/Product.jsx
React - Component Communication
App
Product
Product
Picture
Product
Descrip.
props
props props
React - Product Component
client/Product.jsx
Building Modern Web
Applications using
React & Redux
Redux - 

Basic Flow
• Uni-directional data flow
• Immutable single store
• Action object describing
what happened.
• All state updates are
performed by pure
functions
store.dispatch()
store.subscribe(…)
Container/Presentational Components
Presentational Components Container Components
Purpose How things look 

(markup, styles)
How things work 

(data fetching, state updates)
Aware of Redux No Yes
To read data Read data from props Subscribe to Redux state
To change data Invoke callbacks from props Dispatch Redux actions
ref: http://redux.js.org/docs/basics/UsageWithReact.html
Container/Presentational Components
index.jsx
Container/Presentational Components
./containers/CounterContainer.jsx
Container/Presentational Components
./components/Counter.jsx
Container/Presentational Components
./components/Counter.jsx
React-Redux: Connect
./containers/CounterContainer.jsx
React-Redux: Provider
index.jsx
Building Modern Web
Applications using
React & Redux
61
https://nodejs.org/en/download
Hello World with node.js
http://www.modulecounts.com/
$ node
> console.log('Hello World');
Hello World
Interactive Shell
Execute JavaScript file
$ echo "console.log('Hello World');" > hello.js
$ node hello.js
Hello World
npm - module count
http://www.modulecounts.com/
NPM is the fasts growing and most active public repository
Creating a package.json
{
"name": "my-app",
"version": "0.1.0",
"dependencies": {
…
},
"devDependencies": {
…
},
"scripts": {
…
}
}
package.json
Creating a package.json
package.json
{
"name": "my-app",
"version": "0.1.0",
"dependencies": {
"express": "^4.15.2",
"react": "^15.4.2",
"react-dom": “^15.4.2”,
"react-redux": "^5.0.2",
"react-router": "^3.0.2",
"redux": "^3.6.0",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
…
},
"scripts": {
$ npm install react react-dom … —save
Run
Creating a package.json
package.json
{
"name": "my-app",
"version": "0.1.0",
"dependencies": {
…
},
"devDependencies": {
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"webpack": "^2.3.2"
},
"scripts": {
…
}
$ npm install babel-core babel-loader

.. webpack --save-dev
Run
Creating a package.json
{
"name": "my-app",
"version": "0.1.0",
"dependencies": {
…
},
"devDependencies": {
…
},
"scripts": {
"start": "node server/index.js”,
"build": "webpack --config webpack.config.js"
}
}
package.json
node_modules folder
App Directory
|-client
|-node_modules
|-package.json
|-server
|-webpack.config.js
node_modules folder
webpack.config.js
var config = {
entry:"/index.jsx",
output: {
filename: "bundle.js"
},
module: {
loaders: [{
test: /.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
include: “client”,
}]
}
};
User List/Card Example
Home Component User Component
URL: /user/1URL: /
DEMO
https://github.com/maximenajim/Universal-JavaScript-with-React-Node-and-Redux
Learn More…
Thank You
@softwarecrafts www.oreilly.com/pub/au/6521https://github.com/maximenajim

More Related Content

What's hot (20)

PDF
React.js+Redux Workshops
Marcin Grzywaczewski
 
PPTX
React JS: A Secret Preview
valuebound
 
PDF
React.js and Redux overview
Alex Bachuk
 
PDF
ReactJS presentation
Thanh Tuong
 
PPTX
React / Redux Architectures
Vinícius Ribeiro
 
PPTX
React JS part 1
Diluka Wittahachchige
 
PPTX
React & redux
Cédric Hartland
 
PPSX
React introduction
Kashyap Parmar
 
PPTX
React + Redux + TypeScript === ♥
Remo Jansen
 
PPTX
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
PDF
Workshop React.js
Commit University
 
PPTX
React, Flux and a little bit of Redux
Ny Fanilo Andrianjafy, B.Eng.
 
PPT
React js
Jai Santhosh
 
PDF
Getting Started with React-Nathan Smith
TandemSeven
 
PDF
Designing applications with Redux
Fernando Daciuk
 
PPTX
React.js - The Dawn of Virtual DOM
Jimit Shah
 
PDF
React js
Rajesh Kolla
 
PPTX
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
PPTX
Getting started with Redux js
Citrix
 
PPTX
React js
Oswald Campesato
 
React.js+Redux Workshops
Marcin Grzywaczewski
 
React JS: A Secret Preview
valuebound
 
React.js and Redux overview
Alex Bachuk
 
ReactJS presentation
Thanh Tuong
 
React / Redux Architectures
Vinícius Ribeiro
 
React JS part 1
Diluka Wittahachchige
 
React & redux
Cédric Hartland
 
React introduction
Kashyap Parmar
 
React + Redux + TypeScript === ♥
Remo Jansen
 
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
Workshop React.js
Commit University
 
React, Flux and a little bit of Redux
Ny Fanilo Andrianjafy, B.Eng.
 
React js
Jai Santhosh
 
Getting Started with React-Nathan Smith
TandemSeven
 
Designing applications with Redux
Fernando Daciuk
 
React.js - The Dawn of Virtual DOM
Jimit Shah
 
React js
Rajesh Kolla
 
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
Getting started with Redux js
Citrix
 

Similar to Building Modern Web Applications using React and Redux (20)

PPTX
Spfx with react redux
Rajesh Kumar
 
PPTX
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
MskDotNet Community
 
PDF
Introduction to React, Flux, and Isomorphic Apps
Federico Torre
 
DOC
Why ASP.NET Development is Important?
Ayesha Khan
 
DOC
Asp dot net lifecycle in details
Ayesha Khan
 
PDF
Understanding Facebook's React.js
Federico Torre
 
PDF
An Overview of the React Ecosystem
FITC
 
PPT
Asp.net control
Paneliya Prince
 
PPT
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
Anwar Patel
 
PDF
Performance and Scalability Art of Isomorphic React Applications
Denis Izmaylov
 
PDF
React && React Native workshop
Stacy Goh
 
PDF
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
Zach Lendon
 
PDF
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Zach Lendon
 
PPTX
Introduction to react and redux
Cuong Ho
 
PDF
State Models for React with Redux
Stephan Schmidt
 
PPTX
React + Flux = Joy
John Need
 
PPTX
Damian Kmiecik - Road trip with Redux
PROIDEA
 
PPTX
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
PPTX
Asp.net life cycle in depth
sonia merchant
 
PDF
Asp.net life cycle
Irfaan Khan
 
Spfx with react redux
Rajesh Kumar
 
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
MskDotNet Community
 
Introduction to React, Flux, and Isomorphic Apps
Federico Torre
 
Why ASP.NET Development is Important?
Ayesha Khan
 
Asp dot net lifecycle in details
Ayesha Khan
 
Understanding Facebook's React.js
Federico Torre
 
An Overview of the React Ecosystem
FITC
 
Asp.net control
Paneliya Prince
 
asp-2005311dgvdfvdfvfdfvdvfdbfdb03252 (1).ppt
Anwar Patel
 
Performance and Scalability Art of Isomorphic React Applications
Denis Izmaylov
 
React && React Native workshop
Stacy Goh
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
Zach Lendon
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Zach Lendon
 
Introduction to react and redux
Cuong Ho
 
State Models for React with Redux
Stephan Schmidt
 
React + Flux = Joy
John Need
 
Damian Kmiecik - Road trip with Redux
PROIDEA
 
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
Asp.net life cycle in depth
sonia merchant
 
Asp.net life cycle
Irfaan Khan
 
Ad

Recently uploaded (20)

PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PDF
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PDF
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
PDF
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
PDF
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
PPTX
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPT
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
PDF
NTPC PATRATU Summer internship report.pdf
hemant03701
 
PPTX
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PDF
Bachelor of information technology syll
SudarsanAssistantPro
 
PDF
Digital water marking system project report
Kamal Acharya
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
Distribution reservoir and service storage pptx
dhanashree78
 
PPTX
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
How Industrial Project Management Differs From Construction.pptx
jamespit799
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
NTPC PATRATU Summer internship report.pdf
hemant03701
 
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
Bachelor of information technology syll
SudarsanAssistantPro
 
Digital water marking system project report
Kamal Acharya
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Distribution reservoir and service storage pptx
dhanashree78
 
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
Ad

Building Modern Web Applications using React and Redux