SlideShare a Scribd company logo
UNDERSTANDING
REDUX
Ilya Gelman
Ilya Gelman
- Organizer of AngularJS-IL & ReactJS-Israel
- Passionate about design and UX
Consultant @ 500Tech
WHAT’S WRONG?
User Interface
User Interface
Controller
User Interface
Controller
Model Model
User Interface
Controller
Model Model Model
User Interface
Controller
Model Model Model
Model
User Interface
Controller
Model Model Model Model
Model
User Interface
Controller
Model
Library
Model Model Model
Model Model
User Interface
Controller
Model
LibraryLibrary
Model Model Model
Model Model Model Model
MVVC
Understanding Redux — Ilya Gelman
NEW MINDSET
User Interface
User Interface
Dispatcher
User Interface
Dispatcher
Stores
UNI-DIRECTIONAL DATA FLOW
StoresStores
UI IS RENDERED
UI IS RENDERED
SOMETHING HAPPENED
UI IS RENDERED
SOMETHING HAPPENED
STATE CHANGED
UI IS RENDERED
SOMETHING HAPPENED
STATE CHANGED
UI IS RENDERED
SOMETHING HAPPENED
STATE CHANGED
UI RENDERED
FLUX
KEEP IT SIMPLE
Application state is…
ONE
SINGLE
PLAIN
JAVASCRIPT

OBJECT
Application state is…
READ-ONLY
PURE*
FUNCTION
Current State
Action
New State
* No side-effects
How to change the state
PURE*
FUNCTION
Current State
Action
New State
Reducer
PURE*
FUNCTION
Current State
Action
New State
const newState = reducer(previousState, action);
{ type: 'ACTION_TYPE', /*...*/ }
import { createStore } from 'redux';



const store = createStore(reducer, initialState);
Responsible for creating
a new state every time
The first state we pass
to the reducer
Store
getState() dispatch()
subscribe()
Store
function createStore(reducer, initialState) {

let state = initialState;

return {

dispatch(action) {

state = reducer(state, action);

},

getState() {

return state;

}

}

}
Basic Redux
REDUX ♥ VANILLA JS
REDUX
ONE MORE THING…
npm install --save react-redux
1. Put the in context
import { render } from 'react-dom';

import { Provider } from 'react-redux';

render (

<Provider store={ store }>

<Root />

</Provider>,

document.getElementById('app')

);
Store
2. Connect components to store
import { connect } from 'react-redux';



const ImageList = ({ images }) => (

<ul>

{
images.map((url, index) => (
<li key={ index }>{ url }</li>)
)
}

</ul>

);



const mapStateToProps = (state) => ({ images: state.images });



export default connect(mapStateToProps)(ImageList);
connect(
mapStateToProps,
mapDispatchToProps,
…
)
Maps part of the state
to component’s props
Maps dispatch functions
to component’s props
REDUX ♥ REACT
REDUX ♥ ANGULAR
REDUX ♥ JQUERY
REDUX ♥ BACKBONE
♥ REDUX
QUESTIONS?
Read our blog:
http://blog.500tech.com
Ilya Gelman
ilya@500tech.com

More Related Content

PDF
The Road To Redux
PDF
How to Redux
PDF
Building React Applications with Redux
PPTX
React JS - A quick introduction tutorial
PPTX
20180518 QNAP Seminar - Introduction to React Native
PDF
Redux js
PPTX
Getting started with Redux js
PPTX
Intro to React
The Road To Redux
How to Redux
Building React Applications with Redux
React JS - A quick introduction tutorial
20180518 QNAP Seminar - Introduction to React Native
Redux js
Getting started with Redux js
Intro to React

What's hot (20)

PPT
React js
PDF
State Models for React with Redux
PPTX
[Final] ReactJS presentation
PDF
React and redux
PPTX
React + Redux + TypeScript === ♥
PPTX
React JS: A Secret Preview
PDF
React – Structure Container Component In Meteor
PPTX
Introduction to React JS for beginners
PDF
React state management with Redux and MobX
PDF
Angular redux
PDF
Mobx for Dummies - Yauheni Nikanowich - React Warsaw #5
PDF
PPTX
Intro to React.js
PPTX
React and Flux life cycle with JSX, React Router and Jest Unit Testing
PPSX
React introduction
PDF
An introduction to React.js
PPTX
Reactjs
PDF
Using redux
PPTX
Introduction to React JS
PDF
Introduce Flux & react in practices (KKBOX)
React js
State Models for React with Redux
[Final] ReactJS presentation
React and redux
React + Redux + TypeScript === ♥
React JS: A Secret Preview
React – Structure Container Component In Meteor
Introduction to React JS for beginners
React state management with Redux and MobX
Angular redux
Mobx for Dummies - Yauheni Nikanowich - React Warsaw #5
Intro to React.js
React and Flux life cycle with JSX, React Router and Jest Unit Testing
React introduction
An introduction to React.js
Reactjs
Using redux
Introduction to React JS
Introduce Flux & react in practices (KKBOX)
Ad

Viewers also liked (12)

PPTX
Into the Land of lambda, One Programmer's Journey Into Functional Programming
PPTX
React. Flux. Redux. by Andrey Kolodnitskiy
PDF
Application architecture doesn't have to suck
PDF
Dumb and smart components + redux (1)
PPT
'Did He Really Say That?" effective component communication
PPTX
React. Flux. Redux
PDF
Higher-Order Components — Ilya Gelman
PDF
Angular 2 Component Communication - Talk by Rob McDiarmid
PDF
Simple made easy
PDF
RxJS + Redux + React = Amazing
PPTX
React + Redux Introduction
PDF
Are we there yet?
Into the Land of lambda, One Programmer's Journey Into Functional Programming
React. Flux. Redux. by Andrey Kolodnitskiy
Application architecture doesn't have to suck
Dumb and smart components + redux (1)
'Did He Really Say That?" effective component communication
React. Flux. Redux
Higher-Order Components — Ilya Gelman
Angular 2 Component Communication - Talk by Rob McDiarmid
Simple made easy
RxJS + Redux + React = Amazing
React + Redux Introduction
Are we there yet?
Ad

Similar to Understanding Redux — Ilya Gelman (20)

PPT
The Redux Introduction in react and applications .
PDF
Understanding redux
PDF
Angular2 and Redux - up & running - Nir Kaufman - Codemotion Amsterdam 2016
PPTX
Redux training
PDF
React.js and Redux overview
PDF
Let's discover React and Redux with TypeScript
PPTX
Introduction to Redux.pptx
PDF
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
PDF
Introduction to Redux (for Angular and React devs)
PDF
Intro to Redux | DreamLab Academy #3
PDF
React Redux Interview Questions PDF By ScholarHat
PDF
React Redux Interview Questions PDF By ScholarHat
PPTX
Redux Tech Talk
PPTX
U3-02-React Redux and MUI.pptxaSDFGNXDASDFG
PPTX
Academy PRO: React JS. Redux & Tooling
PPTX
downloads_introduction to redux.pptx
PDF
Getting started with React and Redux
PDF
Redux State Management System A Comprehensive Review
PDF
Redux with angular 2 - workshop 2016
PDF
Redux and context api with react native app introduction, use cases, implemen...
The Redux Introduction in react and applications .
Understanding redux
Angular2 and Redux - up & running - Nir Kaufman - Codemotion Amsterdam 2016
Redux training
React.js and Redux overview
Let's discover React and Redux with TypeScript
Introduction to Redux.pptx
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
Introduction to Redux (for Angular and React devs)
Intro to Redux | DreamLab Academy #3
React Redux Interview Questions PDF By ScholarHat
React Redux Interview Questions PDF By ScholarHat
Redux Tech Talk
U3-02-React Redux and MUI.pptxaSDFGNXDASDFG
Academy PRO: React JS. Redux & Tooling
downloads_introduction to redux.pptx
Getting started with React and Redux
Redux State Management System A Comprehensive Review
Redux with angular 2 - workshop 2016
Redux and context api with react native app introduction, use cases, implemen...

More from 500Tech (20)

PDF
State managment in a world of hooks
PDF
State managment in a world of hooks
PDF
React Under the Hook - DevDays Europe 2019
PDF
React Back to the Future
PDF
Hooks - why should you care today?
PDF
Migrating from angular to react
PDF
How to write bad code in redux (ReactNext 2018)
PDF
Opinionated Approach to Redux
PDF
Mobx Internals
PDF
Mobx - Performance and Sanity
PDF
Mobx Performance and Sanity
PDF
Mobx - performance and sanity
PDF
Tales of an open source library
PDF
Angular2 a modern web platform
PDF
Angular. MobX. Happiness
PDF
Render to DOM
PDF
Managing state in Angular 1.x with Redux
PDF
React vs angular
PDF
D3 svg & angular
PDF
ReactJS vs AngularJS - Head to Head comparison
State managment in a world of hooks
State managment in a world of hooks
React Under the Hook - DevDays Europe 2019
React Back to the Future
Hooks - why should you care today?
Migrating from angular to react
How to write bad code in redux (ReactNext 2018)
Opinionated Approach to Redux
Mobx Internals
Mobx - Performance and Sanity
Mobx Performance and Sanity
Mobx - performance and sanity
Tales of an open source library
Angular2 a modern web platform
Angular. MobX. Happiness
Render to DOM
Managing state in Angular 1.x with Redux
React vs angular
D3 svg & angular
ReactJS vs AngularJS - Head to Head comparison

Recently uploaded (20)

PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
System and Network Administration Chapter 2
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Digital Strategies for Manufacturing Companies
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
System and Network Administraation Chapter 3
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
assetexplorer- product-overview - presentation
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Operating system designcfffgfgggggggvggggggggg
Digital Systems & Binary Numbers (comprehensive )
System and Network Administration Chapter 2
Upgrade and Innovation Strategies for SAP ERP Customers
Digital Strategies for Manufacturing Companies
Design an Analysis of Algorithms I-SECS-1021-03
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Odoo POS Development Services by CandidRoot Solutions
System and Network Administraation Chapter 3
Why Generative AI is the Future of Content, Code & Creativity?
iTop VPN Free 5.6.0.5262 Crack latest version 2025
How to Choose the Right IT Partner for Your Business in Malaysia
CHAPTER 2 - PM Management and IT Context
assetexplorer- product-overview - presentation
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Operating system designcfffgfgggggggvggggggggg

Understanding Redux — Ilya Gelman