SlideShare a Scribd company logo
DATA FLOW
ARCHITECTURE IN
ANGULAR2 WITH REDUX
Nir Kaufman
Deep dive into the pattern & implementation
NIR KUFMN
Nir Kaufman
- Doing Angular for years
- Wrote a book about Angular2
- Plays the electric Bass
Head of Angular Development @ 500Tech
*This picture has been retouched.
The actual speaker may look different
Angular redux
SPEAK.ANGULAR.CO.IL
/user/AngularJSIL
AGENDA
• The basics
• Redux overview & API
• Coffee break
• Project structure - Angular2 / Redux
• Implementing common scenarios
• Next steps
THE CHALLENGE
SPA BECOME INCREASINGLY
COMPLICATED
Angular redux
EVER-CHANGING
STATE
EVERYTHING IS
CONNECTED
TO EVERYTHING
COMPONENT
SERVICE
COMPONENT
SERVICE
COMPONENT
SERVICE
COMPONENT
SERVICE
COMPONENT
SERVICESERVICES
SERVICE
SERVICE
SERVICE
SERVICE
COMPONENTSERVICE
SERVICE
COMPONENT
CHANGING SOMETHING
BREAKS
SOMETHING SOMEWHERE
SOLUTIONS
CQRS*
Use a different model to update information than
the model you use to read information
*Command Query Responsibility Segregation
EVENT SOURCING
Capture all changes to an application state as a
sequence of events.
UI
Commands
Model
Query Model
EVENT
STORE
STORE
(STATE)
EVENTS QUEUE
COMMANDS
QUERIES
STATELESS WEB
ARCHITECTURE
Dependent only on the supplied input

parameters.
IMMUTABLE OBJECT
An object whose state cannot be modified
after it is created.
ENTER REDUX
REDUX
Predictable state container for JavaScript apps.
SINGLE SOURCE
OF TRUTH
“The state of your whole application is stored in
an object tree within a single store”
THE STATE IS
READ ONLY
“The only way to mutate the state is to emit an
action, an object describing what happened.”
PURE FUNCTIONS
“To specify how the state tree is transformed by
actions, you write pure reducers.”
Every interaction with the view results with an action

that is sent to the store and mutates the state
ACTIONS
UI STATEACTION
The view doesn’t create the action. It calls a method

on an action creator that results with an action
ACTION CREATOR
UI STATEACTION
ACTION
CREATOR
The action hits a reducer that takes the state and
the action and produces a new state
REDUCER
UI
NEW
STATE
ACTION
ACTION
CREATOR
STATE
REDUCER
A middleware can catch an action before it hits the
reducer for applying async operations or other logic.
MIDDLEWARE
UI
NEW
STATE
ACTION
ACTION
CREATOR
STATE
REDUCER
MIDDLE
WARES
UI
MIDDLEWARES
ACTION
STATE REDUCER
ACTION
CREATOR
ACTION
DATA FLOW
REDUX IS
TINYONLY FIVE METHODS
THE STORE
store = createStore(reducer)
STATEREDUCER
dispatch(action) subscribe(listener)
getState()
ACTIONS & CREATORS
ARE JUST PLAIN OLD
JAVASCRIPT
ALL THE REST
combineReducers(reducers)
applyMiddleware(middlewares)
compose(functions)
bindActionCreators(creators, dispatch)
LIVE CODING
Exploring redux API
https://github.com/nirkaufman/redux-playground
ANGULAR 2 & REDUX
FOLDER STRUCTURE
Group by type, keep the UI in its own folder
src
components
actions
reducers
middleware
constants
ANGULAR BINDINGS
Convenience methods for cleaner code
UI state
NG2-REDUX
unsubscribe = connect(mapState,mapActions);
https://github.com/wbuchwalter/ng2-redux
LIVE CODING
STEP 1
THE TODO LIST
STEP 2REDUX DEVTOOLS
STEP 3LOGGER MIDDLEWARE
STEP 4ASYNC DATA FLOW
STEP 5ADDING REDO/UNDO
NEXT STEPS
RESOURCES
CQRS
• https://msdn.microsoft.com/en-us/library/dn568103.aspx
• http://martinfowler.com/bliki/CQRS.html
EVENT SOURCING
• https://msdn.microsoft.com/en-us/library/dn589792.aspx
REDUX DEV-TOOLS
• https://github.com/zalmoxisus/redux-devtools-extension
UNDO/REDO
• https://github.com/omnidan/redux-undo
REDUX
• http://redux.js.org/
THANKS!
Nir@500tech.com

@nirkaufman on twitter
slideshare.net/nirkaufman/
github.com/nirkaufman
All pictures belong
to their respective authors

More Related Content

PDF
Redux data flow with angular 2
PDF
Redux js
PDF
Reactive.architecture.with.Angular
PPTX
Better React state management with Redux
PDF
redux and angular - up and running
PDF
State Models for React with Redux
PDF
Building React Applications with Redux
PPTX
Getting started with Redux js
Redux data flow with angular 2
Redux js
Reactive.architecture.with.Angular
Better React state management with Redux
redux and angular - up and running
State Models for React with Redux
Building React Applications with Redux
Getting started with Redux js

What's hot (20)

PDF
Designing applications with Redux
PDF
React.js+Redux Workshops
PDF
Evan Schultz - Angular Camp - ng2-redux
PDF
Let's Redux!
PDF
How to Redux
PDF
Introduction to React & Redux
PDF
Workshop 22: React-Redux Middleware
PDF
Using redux
PDF
Creating a WYSIWYG Editor with React
PDF
React and redux
PDF
Let's discover React and Redux with TypeScript
PPTX
ProvJS: Six Months of ReactJS and Redux
PPTX
Redux workshop
PPT
React js
PPTX
React / Redux Architectures
PPTX
React + Redux + TypeScript === ♥
PPTX
Redux in Angular2 for jsbe
PDF
React Lifecycle and Reconciliation
PDF
The Road To Redux
PDF
React.js and Redux overview
Designing applications with Redux
React.js+Redux Workshops
Evan Schultz - Angular Camp - ng2-redux
Let's Redux!
How to Redux
Introduction to React & Redux
Workshop 22: React-Redux Middleware
Using redux
Creating a WYSIWYG Editor with React
React and redux
Let's discover React and Redux with TypeScript
ProvJS: Six Months of ReactJS and Redux
Redux workshop
React js
React / Redux Architectures
React + Redux + TypeScript === ♥
Redux in Angular2 for jsbe
React Lifecycle and Reconciliation
The Road To Redux
React.js and Redux overview
Ad

Viewers also liked (20)

PDF
Redux with angular 2 - workshop 2016
PDF
Functional Reactive Angular 2
PDF
Webpack and angularjs
PDF
AngularJS - Services
PDF
Data Structures in javaScript 2015
PDF
Up & running with ECMAScript6
PDF
Solid angular
PDF
Angular js - 10 reasons to choose angularjs
PDF
Programação reativa com RxJS e Angular
PDF
Angular2 & ngrx/store: Game of States
PDF
Angular Pipes Workshop
PDF
Angular2 with TypeScript
PDF
Angular Promises and Advanced Routing
PDF
Angular js routing options
PDF
How Angular2 Can Improve Your AngularJS Apps Today!
PDF
Angularjs - Unit testing introduction
PDF
Angular2 - getting-ready
PDF
AngularJS performance & production tips
PDF
Angular2 workshop
Redux with angular 2 - workshop 2016
Functional Reactive Angular 2
Webpack and angularjs
AngularJS - Services
Data Structures in javaScript 2015
Up & running with ECMAScript6
Solid angular
Angular js - 10 reasons to choose angularjs
Programação reativa com RxJS e Angular
Angular2 & ngrx/store: Game of States
Angular Pipes Workshop
Angular2 with TypeScript
Angular Promises and Advanced Routing
Angular js routing options
How Angular2 Can Improve Your AngularJS Apps Today!
Angularjs - Unit testing introduction
Angular2 - getting-ready
AngularJS performance & production tips
Angular2 workshop
Ad

Similar to Angular redux (20)

PDF
Evan Schultz - Angular Summit - 2016
PDF
Dumb and smart components + redux (1)
PDF
Angular2 and Redux - up & running - Nir Kaufman - Codemotion Amsterdam 2016
PDF
Introduction to Redux (for Angular and React devs)
PDF
Redux in Angular 2+
PDF
Redux data flow with angular
PDF
Redux tutorial - intro to Redux by GetLittleTech
PDF
Understanding redux
PPTX
Redux Tech Talk
PPTX
Reducers+flux=redux
PDF
Ngrx slides
PDF
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
PDF
Redux data flow with angular
PPTX
Damian Kmiecik - Road trip with Redux
PDF
Predictable reactive state management - ngrx
PPTX
Academy PRO: React JS. Redux & Tooling
PPTX
downloads_introduction to redux.pptx
PDF
ngSummit 2017: Angular meets Redux
PDF
Redux State Management System A Comprehensive Review
PPT
The Redux Introduction in react and applications .
Evan Schultz - Angular Summit - 2016
Dumb and smart components + redux (1)
Angular2 and Redux - up & running - Nir Kaufman - Codemotion Amsterdam 2016
Introduction to Redux (for Angular and React devs)
Redux in Angular 2+
Redux data flow with angular
Redux tutorial - intro to Redux by GetLittleTech
Understanding redux
Redux Tech Talk
Reducers+flux=redux
Ngrx slides
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
Redux data flow with angular
Damian Kmiecik - Road trip with Redux
Predictable reactive state management - ngrx
Academy PRO: React JS. Redux & Tooling
downloads_introduction to redux.pptx
ngSummit 2017: Angular meets Redux
Redux State Management System A Comprehensive Review
The Redux Introduction in react and applications .

More from Nir Kaufman (13)

PDF
Angular Dependency Injection
PDF
Angular Prestige: Less-known API and techniques
PDF
Angular CLI custom builders
PDF
Electronic music 101 for developers
PDF
Nestjs MasterClass Slides
PDF
Redux pattens - JSHeroes 2018
PDF
Angular EE - Special Workshop by Nir Kaufman
PDF
Boosting Angular runtime performance
PDF
Decorators in js
PDF
Styling recipes for Angular components
PDF
Introduction To Angular's reactive forms
PDF
Webstorm
PDF
Angularjs - lazy loading techniques
Angular Dependency Injection
Angular Prestige: Less-known API and techniques
Angular CLI custom builders
Electronic music 101 for developers
Nestjs MasterClass Slides
Redux pattens - JSHeroes 2018
Angular EE - Special Workshop by Nir Kaufman
Boosting Angular runtime performance
Decorators in js
Styling recipes for Angular components
Introduction To Angular's reactive forms
Webstorm
Angularjs - lazy loading techniques

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Modernizing your data center with Dell and AMD
PPTX
Cloud computing and distributed systems.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Advanced IT Governance
NewMind AI Weekly Chronicles - August'25 Week I
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Modernizing your data center with Dell and AMD
Cloud computing and distributed systems.
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Empathic Computing: Creating Shared Understanding
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
The Rise and Fall of 3GPP – Time for a Sabbatical?
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
MYSQL Presentation for SQL database connectivity
madgavkar20181017ppt McKinsey Presentation.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Per capita expenditure prediction using model stacking based on satellite ima...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
GamePlan Trading System Review: Professional Trader's Honest Take
Advanced IT Governance

Angular redux