SlideShare a Scribd company logo
React. Flux. Redux
The big picture and architectures overview
• Brief history overview
• What is React?
• How it differs from others?
• What is Flux?
• What is Redux?
• Demos
• Useful links
Agenda
React. Flux. Redux. by Andrey Kolodnitskiy
React. Flux. Redux. by Andrey Kolodnitskiy
React. Flux. Redux. by Andrey Kolodnitskiy
Event
driven
MVC
Data-
binding
The evolution looked like
• Working with DOM
• Reusability
• Complexity
What those did not resolve?
• React is library for building UI
• It’s open source
• Intended to be the view in MVC
• Can be integrated with other libraries
What is React?
• Working with DOM
• Reusability
• Complexity
What it tries to solve?
• The major issue it was not designed for
changes
• Shadow DOM standard is under development
• Another way to solve it is Virtual DOM
DOM
Re-render
entire
DOM
Build a
new
Virtual
DOM tree
Diff with
old
Compute
minimal
mutation
Batch
execute
all
updates
Virtual DOM
• It contains UI & logic
• It has strict interface
• It has to be stateless
Reusability – Everything is a component
It contains UI & Logic
It contains UI & Logic
It contains UI & Logic
• Application is a set of small components
• Components have strict interface & data is
immutable
• There is data flow concept
• Ryan Anklam: React & The Art of Managing
Complexity
Complexity
• Known as one way data binding
• View cannot change state instead when state is
changed view is re-rendered
• Unidirectional data flow
Data Flow
Demo
• Good ES6 support
• Browser compatibility
• Fails fast and clear
What else React brings?
• Mental shift
– you need to think in terms of the components
– you need to control data flow in the app
– your components should be stateless
• What you’d get:
– Fast DOM manipulations
– Reusable, small and easy to support components
– Browser compatibility
– Unit testable code
– Ability to integrate in the existing app or library
Sum up
• https://facebook.github.io/react/docs/getting-
started.html
• https://facebook.github.io/react/docs/thinking-in-
react.html
• https://www.youtube.com/watch?v=nYkdrAPrdcw
• Dev tools: https://github.com/facebook/react-devtools
Useful links
• Application architecture
• Can be treated more like a pattern
• Uses unidirectional data flow
• There are a lot of different implementations for
What is Flux?
Flux
Demo
• A lot of boilerplate code
• Code is specific to the Flux framework you are
using
• Store logic has dependency on its state
• Dispatcher cannot dispatch while dispatching
Sounds cool but does it have issues?
• Flummox
• Alt
• Fluxxor
• And many others: https://medium.com/social-
tables-tech/we-compared-13-top-flux-
implementations-you-won-t-believe-who-
came-out-on-top-1063db32fe73#.lpfhvx17u
Libraries
Dispatching issue
https://github.com/facebook/flux/issues/47
One more look
• https://facebook.github.io/flux/docs/overview.html
• https://medium.com/social-tables-tech/we-compared-13-top-flux-
implementations-you-won-t-believe-who-came-out-on-top-
1063db32fe73#.lpfhvx17u
Useful links
• Flux is architecture based on unidirectional
data flow
• It has certain issues the major one is that in
real life change in the store would create new
actions
• There are a lot of libraries that implement Flux
• Flux-enabling libraries race is finished with the
Redux win
Sum up
Redux
• Predictable state container for React developed
by Dan Abramov
• Inspired by Elm
• Based on 3 principles:
– Single source of truth. The state of your application is stored in a single store
– State is read-only. The only way to mutate the state is through emitting an action
– Changes are made with pure functions. You specify how your state transformed in
reducer function.
What is Redux?
Redux architecture
• One Store
• Action creators
• Reducers
• Actions can dispatch and call other action
creators
What is the main difference?
Demo
https://www.youtube.com/watch?v=xsSnOQynTHs
• http://redux.js.org/index.html
• https://www.youtube.com/watch?v=DfRibIkjhew
• https://www.youtube.com/watch?v=xsSnOQynTHs
• http://redux.js.org/docs/introduction/Ecosystem.html
• https://egghead.io/lessons/javascript-redux-the-single-immutable-
state-tree
Useful links
• It’s a data flow architecture
• Redux introduces limitations to the way you
work with application state
• Has time machine. Which allows to easily
replicate issues
• Supports hot reloading
• Has nice tools and community around
• Just go and try it
Sum up
Thank You!

More Related Content

PPTX
React. Flux. Redux
PPTX
Marionette talk 2016
PPT
Building Reactive webapp with React/Flux
PPTX
Reactive Web Development with Spring Boot 2
PPTX
Introduction to react native with redux
PDF
20161103 Serverless Italy Meetup
PPTX
cloudstack participation
React. Flux. Redux
Marionette talk 2016
Building Reactive webapp with React/Flux
Reactive Web Development with Spring Boot 2
Introduction to react native with redux
20161103 Serverless Italy Meetup
cloudstack participation

What's hot (20)

PPTX
Advantages of Rails Framework
PPTX
Flux and React.js
PDF
AtlasCamp 2015: Plugins 2: All grown up
PPTX
Validating latest changes with XCI
PDF
Dev112 let's calendar that
PDF
Devops and Immutable infrastructure - Cloud Expo 2015 NYC
PDF
How to audit Drupal Sites for performance, content and best practices
PPT
PPTX
Essential git for developers
PDF
React talk, GrunnJs 24 September 2014
PPTX
ASP.NET Core Demos
PPTX
ASP.NET Core Demos Part 2
PDF
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - Panorays
PDF
Drupal Site Audit - SFDUG
PDF
OpenNTF Webinar, October 2020
PDF
OpenNTF Webinar, May 19, 2020
PDF
Advanced Core Data - The Things You Thought You Could Ignore
PPTX
How to contribute to an open source project and don’t die during the Code Rev...
PDF
AtlasCamp 2013: A Re-Intriduction to Atlassian Connect: Add-ons for OnDemand
PPTX
Kudu voodoo slideshare
Advantages of Rails Framework
Flux and React.js
AtlasCamp 2015: Plugins 2: All grown up
Validating latest changes with XCI
Dev112 let's calendar that
Devops and Immutable infrastructure - Cloud Expo 2015 NYC
How to audit Drupal Sites for performance, content and best practices
Essential git for developers
React talk, GrunnJs 24 September 2014
ASP.NET Core Demos
ASP.NET Core Demos Part 2
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - Panorays
Drupal Site Audit - SFDUG
OpenNTF Webinar, October 2020
OpenNTF Webinar, May 19, 2020
Advanced Core Data - The Things You Thought You Could Ignore
How to contribute to an open source project and don’t die during the Code Rev...
AtlasCamp 2013: A Re-Intriduction to Atlassian Connect: Add-ons for OnDemand
Kudu voodoo slideshare
Ad

Viewers also liked (10)

PPTX
Into the Land of lambda, One Programmer's Journey Into Functional Programming
PDF
Understanding Redux — Ilya Gelman
PDF
Application architecture doesn't have to suck
PDF
Dumb and smart components + redux (1)
PPT
'Did He Really Say That?" effective component communication
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
Understanding Redux — Ilya Gelman
Application architecture doesn't have to suck
Dumb and smart components + redux (1)
'Did He Really Say That?" effective component communication
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 React. Flux. Redux. by Andrey Kolodnitskiy (20)

PPTX
What is flux architecture in react
PDF
JBug_React_and_Flux_2015
PPTX
React.js at Cortex
ODP
Fluxxor react library
PDF
Introduce flux & react in practice
PDF
An Intense Overview of the React Ecosystem
PDF
Flux architecture and Redux - theory, context and practice
PDF
Manage the Flux of your Web Application: Let's Redux
PPTX
Intro to Flux - ReactJS Warsaw #1
PDF
React & Flux Workshop
PDF
[@NaukriEngineering] Flux Architecture
PPSX
React introduction
PPTX
React + Flux = Joy
PPTX
PDF
React, Flux, and Realtime RSVPs
PDF
Introduce Flux & react in practices (KKBOX)
PDF
The Road To Redux
PDF
From Back to Front: Rails To React Family
PDF
An Overview of the React Ecosystem
What is flux architecture in react
JBug_React_and_Flux_2015
React.js at Cortex
Fluxxor react library
Introduce flux & react in practice
An Intense Overview of the React Ecosystem
Flux architecture and Redux - theory, context and practice
Manage the Flux of your Web Application: Let's Redux
Intro to Flux - ReactJS Warsaw #1
React & Flux Workshop
[@NaukriEngineering] Flux Architecture
React introduction
React + Flux = Joy
React, Flux, and Realtime RSVPs
Introduce Flux & react in practices (KKBOX)
The Road To Redux
From Back to Front: Rails To React Family
An Overview of the React Ecosystem

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
RMMM.pdf make it easy to upload and study
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Basic Mud Logging Guide for educational purpose
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
master seminar digital applications in india
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
01-Introduction-to-Information-Management.pdf
PDF
Pre independence Education in Inndia.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
RMMM.pdf make it easy to upload and study
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Basic Mud Logging Guide for educational purpose
VCE English Exam - Section C Student Revision Booklet
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Pharma ospi slides which help in ospi learning
master seminar digital applications in india
102 student loan defaulters named and shamed – Is someone you know on the list?
Insiders guide to clinical Medicine.pdf
Institutional Correction lecture only . . .
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Supply Chain Operations Speaking Notes -ICLT Program
PPH.pptx obstetrics and gynecology in nursing
01-Introduction-to-Information-Management.pdf
Pre independence Education in Inndia.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Final Presentation General Medicine 03-08-2024.pptx

React. Flux. Redux. by Andrey Kolodnitskiy

Editor's Notes

  • #10: Working with DOM – Virtual DOM Reusability – Everything is a component that contains logic & UI for Complexity – Application is divided into set of small independent, reusable and stateless components and follows data flow architecture
  • #12: Instead of changing real DOM we are changing its lightweight in-memory representation Then diff between previous in-memory copy and new is defined Then diff is applied to the real DOM React Virtual DOM implementation knows When and How to effectively apply changes By applying changes only when needed and minimizing number of operation with real DOM we get better performance
  • #13: In React everything is a component Component is self-contained and can be placed anywhere if we suit its interface Component has lifecycle events it can react to Component contains layout (UI) Component has defined interface Can contain other components Should be stateless Note: Component is meant in general sense. Let’s skip React.Element vs React.Component for simplicity reasons
  • #15: UI & logic is in one file. My component is responsible for everything, what a hell! What about SRP and Separation of concerns, have you heard of?
  • #16: Let’s think of it differently. The component handles everything and thus can be easily reused Normally when you adjust component logic you have to update its template So for the 1 reason of change you do change 2 files It is easier to figure out component logic and its representation when everything tied together
  • #17: Application has to be split into series of small components which are responsible for small piece of logic and thus they are quite simple There is data flow concept which defines how component should get/set data which makes easy to track all the changes
  • #18: So what that brings: Same data produces same view output Data changes are predictable and easier to track related changes
  • #19: So what that brings: Same data produces same view output Data changes are predictable and easier to track related changes
  • #20: So what that brings: Same data produces same view output Data changes are predictable and easier to track related changes
  • #21: So what that brings: Same data produces same view output Data changes are predictable and easier to track related changes
  • #24: Dispatcher: The dispatcher is the central hub that manages all data flow It is a registry of callbacks into the stores In other words: mechanism to deliver actions into the stores Action: Typically triggered by the View Contains information about change made to the application Store: Contain application state and logic Reacts to specific actions Issue events when data or state is updated View: Has list of stores which provide data for Triggers actions with the state change Reacts to specific events in the store
  • #25: So what that brings: Same data produces same view output Data changes are predictable and easier to track related changes
  • #29: The issue here is that we cannot create new actions while handling an action. As a result our code has to get back to the view which will dispatch new actions. The View now has information about application logic how/when to start new actions. Has a lot of boilerplate code which waits for the action execution to start new actions. Our views become messy
  • #34: Store: Holds application state Allows state to be updated via dispatch Register/Unregister state change listeners Actions and Action creators Actions describe that fact that something happened Action creators are functions that create actions Actions and action creators can be async Can dispatch other actions Reducers Pure functions Should be stateless reducer(currentState, action) { return newState; } In case state is not changed return passed state back Do not modify passed state (State has to be Immutable)