SlideShare a Scribd company logo
REACT. FLUX.
REDUX
React: The big picture and architectures over view
ANDREI COLODNITCHII
AGENDA
• Brief history overview
• What is React?
• How it differs from others?
• What is Flux?
• What is Redux?
• Demos
• Useful links
History Overview 46
History overview
Brief overview
History Overview 48
History Overview 49
History Overview 50
SO THE EVOLUTION LOOKED LIKE
History Overview 51
Event
Driven
MVC
Data-
binding
WHAT THOSE DID NOT RESOLVE?
• Working with DOM
• Reusability
• Complexity
History Overview 52
What is React?
React overview
WHAT IS REACT?
• 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? 54
WHAT IT TRIES TO SOLVE?
• Working with DOM
• Reusability
• Complexity
What is React? 55
DOM
• The major issue it was not designed for changes
• Shadow DOM standard is under development
• Another way to solve it is Virtual DOM
What is React? 56
VIRTUAL DOM
What is React? 57
Re-render entire
DOM
Build a new
Virtual DOM tree
Diff with old
Compute minimal
mutation
Batch execute all
updates
REUSABILITY – EVERYTHING IS A COMPONENT
• It contains UI & logic
• It has strict interface
• It has to be stateless
What is React? 58
IT CONTAINS UI & LOGIC
What is React? 59
IT CONTAINS UI & LOGIC
What is React? 60
IT CONTAINS UI & LOGIC
What is React? 61
COMPLEXITY
• 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
What is React? 62
DATA FLOW
• Known as one way data binding
• View cannot change state instead when state is changed view is
re-rendered
• Unidirectional data flow
What is React? 63
DEMO
What is React? 64
WHAT ELSE REACT BRINGS?
• Good ES6 support
• Browser compatibility
• Fails fast and clear
What is React? 65
SUM UP
• 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
What is React? 66
USEFUL LINKS FOR THE SECTION
• 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
What is React? 67
What is Flux?
Flux overview
WHAT IS FLUX?
• Application architecture
• Can be treated more like a pattern
• Uses unidirectional data flow
• There are a lot of different implementations for
What is flux? 69
FLUX PARTS
What is flux? 70
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
What is flux? 71
ACTION
• Typically triggered by the View
• Contains information about change made to the application
What is flux? 72
STORE
• Contain application state and logic
• Reacts to specific actions
• Issue events when data or state is updated
What is flux? 73
VIEW
• Has list of stores which provide data for
• Triggers actions with the state change
• Reacts to specific events in the store
What is flux? 74
LIBRARIES
• 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
What is flux? 75
DEMO
What is flux? 76
SOUNDS COOL BUT DOES IT HAVE ISSUES?
• 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
What is flux? 77
DISPATCHING ISSUE
What is flux? 78
https://github.com/facebook/flux/issues/47
ONE MORE LOOK
What is flux? 79
USEFUL LINKS FOR THE SECTION
• 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
What is flux? 80
SUM UP
• 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
What is flux? 81
What is Redux?
Redux overview
WHAT IS REDUX?
What is Redux? 83
WHAT IS 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? 84
REDUX ARCHITECTURE
What is Redux? 85
WHAT IS THE MAIN DIFFERENCE?
• One Store
• Action creators
• Reducers
• Actions can dispatch and call other action creators
What is Redux? 86
STORE
• Holds application state
• Allows state to be updated via dispatch
• Register/Unregister state change listeners
What is Redux? 87
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
What is Redux? 88
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)
What is Redux? 89
TIME MACHINE
What is Redux? 90
https://www.youtube.com/watch?v=xsSnOQynTHs
DEMO
What is Redux? 91
USEFUL LINKS FOR THE SECTION
• 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
What is Redux? 92
SUM UP
• 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
What is Redux? 93
Questions?
Thanks

More Related Content

What's hot (20)

PPSX
React introduction
Kashyap Parmar
 
PDF
Azkaban
Anatoliy Nikulin
 
PPTX
Flux architecture
Boyan Mihaylov
 
PPTX
React.js - The Dawn of Virtual DOM
Jimit Shah
 
PDF
Introduction to react
kiranabburi
 
PPT
Flux architecture
Badr Zaman [Front End , J2EE ]
 
PDF
Introduction to React and Flux (CodeLabs)
Eueung Mulyana
 
PDF
Thinking in React
Xcat Liu
 
PPTX
Introduction to React
Austin Garrod
 
PPTX
001. Introduction about React
Binh Quan Duc
 
PDF
Modern javascript
Kevin Ball
 
PDF
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Lauren Yew
 
PPTX
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...
Provectus
 
PPTX
Uniqueness of java
Sandeep Pandey
 
PPTX
No Container: a Modern Java Stack with Bootique
Andrus Adamchik
 
PPTX
React101 v3
Janice Gluck
 
PDF
Learning React - I
Mitch Chen
 
PPTX
Agile sites2
Michele Sciabarrà
 
PPT
Java EE revisits design patterns
Alex Theedom
 
React introduction
Kashyap Parmar
 
Flux architecture
Boyan Mihaylov
 
React.js - The Dawn of Virtual DOM
Jimit Shah
 
Introduction to react
kiranabburi
 
Introduction to React and Flux (CodeLabs)
Eueung Mulyana
 
Thinking in React
Xcat Liu
 
Introduction to React
Austin Garrod
 
001. Introduction about React
Binh Quan Duc
 
Modern javascript
Kevin Ball
 
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Lauren Yew
 
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...
Provectus
 
Uniqueness of java
Sandeep Pandey
 
No Container: a Modern Java Stack with Bootique
Andrus Adamchik
 
React101 v3
Janice Gluck
 
Learning React - I
Mitch Chen
 
Agile sites2
Michele Sciabarrà
 
Java EE revisits design patterns
Alex Theedom
 

Viewers also liked (20)

PDF
Unidirectional Data Flow Architecture (Redux) in Swift
Seyhun AKYUREK
 
PDF
Designing applications with Redux
Fernando Daciuk
 
PPTX
Flux and redux
Morgan Cheng
 
PPTX
Into the Land of lambda, One Programmer's Journey Into Functional Programming
Mike Pence
 
PPTX
Reducers+flux=redux
Shmulik Chicvashvili
 
PDF
Understanding Redux — Ilya Gelman
500Tech
 
PDF
Redux vs Alt
Uldis Sturms
 
PDF
Dumb and smart components + redux (1)
Brecht Billiet
 
PDF
Application architecture doesn't have to suck
jtregunna
 
PPTX
JavaScript in Mobile Development
Dima Maleev
 
PPTX
Creation of ideas
Mykola Hlibovych
 
PDF
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
NoSQLmatters
 
PDF
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
Serhiy Batyuk
 
PPT
'Did He Really Say That?" effective component communication
Gus Sabatino
 
PPTX
Spark - Migration Story
Roman Chukh
 
PPTX
Big data analysis in java world
Serg Masyutin
 
PDF
Tweaking performance on high-load projects
Dmitriy Dumanskiy
 
PDF
Apache HBase Workshop
Valerii Moisieienko
 
PDF
Migrating from Flux to Redux. Why and how.
Astrails
 
PPTX
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчик
Nick Grachov
 
Unidirectional Data Flow Architecture (Redux) in Swift
Seyhun AKYUREK
 
Designing applications with Redux
Fernando Daciuk
 
Flux and redux
Morgan Cheng
 
Into the Land of lambda, One Programmer's Journey Into Functional Programming
Mike Pence
 
Reducers+flux=redux
Shmulik Chicvashvili
 
Understanding Redux — Ilya Gelman
500Tech
 
Redux vs Alt
Uldis Sturms
 
Dumb and smart components + redux (1)
Brecht Billiet
 
Application architecture doesn't have to suck
jtregunna
 
JavaScript in Mobile Development
Dima Maleev
 
Creation of ideas
Mykola Hlibovych
 
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
NoSQLmatters
 
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
Serhiy Batyuk
 
'Did He Really Say That?" effective component communication
Gus Sabatino
 
Spark - Migration Story
Roman Chukh
 
Big data analysis in java world
Serg Masyutin
 
Tweaking performance on high-load projects
Dmitriy Dumanskiy
 
Apache HBase Workshop
Valerii Moisieienko
 
Migrating from Flux to Redux. Why and how.
Astrails
 
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчик
Nick Grachov
 
Ad

Similar to React. Flux. Redux (20)

PPTX
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
ODP
Fluxxor react library
Karthick Kumar
 
PDF
[@NaukriEngineering] Flux Architecture
Naukri.com
 
PPTX
What is flux architecture in react
BOSC Tech Labs
 
PDF
The Road To Redux
Jeffrey Sanchez
 
PDF
Manage the Flux of your Web Application: Let's Redux
Commit University
 
PPTX
React.js at Cortex
Geoff Harcourt
 
PDF
An Intense Overview of the React Ecosystem
Rami Sayar
 
PDF
Getting started with React and Redux
Paddy Lock
 
PDF
Flux architecture and Redux - theory, context and practice
Jakub Kocikowski
 
PPTX
React + Flux = Joy
John Need
 
PDF
An Introduction to Redux
NexThoughts Technologies
 
PPTX
Redux
Maulik Shah
 
PDF
An Overview of the React Ecosystem
FITC
 
PDF
Content-Driven Apps with React
Netcetera
 
PDF
ReactRedux.pdf
Arsalan malik
 
PPTX
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
PDF
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
PDF
Introduction to Redux (for Angular and React devs)
Fabio Biondi
 
PPTX
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
Fluxxor react library
Karthick Kumar
 
[@NaukriEngineering] Flux Architecture
Naukri.com
 
What is flux architecture in react
BOSC Tech Labs
 
The Road To Redux
Jeffrey Sanchez
 
Manage the Flux of your Web Application: Let's Redux
Commit University
 
React.js at Cortex
Geoff Harcourt
 
An Intense Overview of the React Ecosystem
Rami Sayar
 
Getting started with React and Redux
Paddy Lock
 
Flux architecture and Redux - theory, context and practice
Jakub Kocikowski
 
React + Flux = Joy
John Need
 
An Introduction to Redux
NexThoughts Technologies
 
An Overview of the React Ecosystem
FITC
 
Content-Driven Apps with React
Netcetera
 
ReactRedux.pdf
Arsalan malik
 
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
Introduction to Redux (for Angular and React devs)
Fabio Biondi
 
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
Ad

Recently uploaded (20)

PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 

React. Flux. Redux

  • 1. REACT. FLUX. REDUX React: The big picture and architectures over view ANDREI COLODNITCHII
  • 2. AGENDA • Brief history overview • What is React? • How it differs from others? • What is Flux? • What is Redux? • Demos • Useful links History Overview 46
  • 7. SO THE EVOLUTION LOOKED LIKE History Overview 51 Event Driven MVC Data- binding
  • 8. WHAT THOSE DID NOT RESOLVE? • Working with DOM • Reusability • Complexity History Overview 52
  • 10. WHAT IS REACT? • 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? 54
  • 11. WHAT IT TRIES TO SOLVE? • Working with DOM • Reusability • Complexity What is React? 55
  • 12. DOM • The major issue it was not designed for changes • Shadow DOM standard is under development • Another way to solve it is Virtual DOM What is React? 56
  • 13. VIRTUAL DOM What is React? 57 Re-render entire DOM Build a new Virtual DOM tree Diff with old Compute minimal mutation Batch execute all updates
  • 14. REUSABILITY – EVERYTHING IS A COMPONENT • It contains UI & logic • It has strict interface • It has to be stateless What is React? 58
  • 15. IT CONTAINS UI & LOGIC What is React? 59
  • 16. IT CONTAINS UI & LOGIC What is React? 60
  • 17. IT CONTAINS UI & LOGIC What is React? 61
  • 18. COMPLEXITY • 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 What is React? 62
  • 19. DATA FLOW • Known as one way data binding • View cannot change state instead when state is changed view is re-rendered • Unidirectional data flow What is React? 63
  • 21. WHAT ELSE REACT BRINGS? • Good ES6 support • Browser compatibility • Fails fast and clear What is React? 65
  • 22. SUM UP • 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 What is React? 66
  • 23. USEFUL LINKS FOR THE SECTION • 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 What is React? 67
  • 24. What is Flux? Flux overview
  • 25. WHAT IS FLUX? • Application architecture • Can be treated more like a pattern • Uses unidirectional data flow • There are a lot of different implementations for What is flux? 69
  • 26. FLUX PARTS What is flux? 70
  • 27. 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 What is flux? 71
  • 28. ACTION • Typically triggered by the View • Contains information about change made to the application What is flux? 72
  • 29. STORE • Contain application state and logic • Reacts to specific actions • Issue events when data or state is updated What is flux? 73
  • 30. VIEW • Has list of stores which provide data for • Triggers actions with the state change • Reacts to specific events in the store What is flux? 74
  • 31. LIBRARIES • 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 What is flux? 75
  • 33. SOUNDS COOL BUT DOES IT HAVE ISSUES? • 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 What is flux? 77
  • 34. DISPATCHING ISSUE What is flux? 78 https://github.com/facebook/flux/issues/47
  • 35. ONE MORE LOOK What is flux? 79
  • 36. USEFUL LINKS FOR THE SECTION • 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 What is flux? 80
  • 37. SUM UP • 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 What is flux? 81
  • 39. WHAT IS REDUX? What is Redux? 83
  • 40. WHAT IS 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? 84
  • 42. WHAT IS THE MAIN DIFFERENCE? • One Store • Action creators • Reducers • Actions can dispatch and call other action creators What is Redux? 86
  • 43. STORE • Holds application state • Allows state to be updated via dispatch • Register/Unregister state change listeners What is Redux? 87
  • 44. 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 What is Redux? 88
  • 45. 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) What is Redux? 89
  • 46. TIME MACHINE What is Redux? 90 https://www.youtube.com/watch?v=xsSnOQynTHs
  • 48. USEFUL LINKS FOR THE SECTION • 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 What is Redux? 92
  • 49. SUM UP • 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 What is Redux? 93

Editor's Notes

  • #5: JQuery: event driven pre SPA Complex Apps are hell to write and support
  • #6: Introduced MVC Designed for SPA Declarative events Works with any view engine Marionette: Message Bus Different View types
  • #7: Framework Exposes MVW Designed for SPA Introduces a lot of concepts Unit testable
  • #12: 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
  • #14: 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
  • #15: 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
  • #17: 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?
  • #18: 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
  • #19: 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
  • #20: So what that brings: Same data produces same view output Data changes are predictable and easier to track related changes
  • #36: 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