SlideShare ist ein Scribd-Unternehmen logo
1 von 50
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

Weitere ähnliche Inhalte

Was ist angesagt?

React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMJimit Shah
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to reactkiranabburi
 
Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)Eueung Mulyana
 
Thinking in React
Thinking in ReactThinking in React
Thinking in ReactXcat Liu
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to ReactAustin Garrod
 
001. Introduction about React
001. Introduction about React001. Introduction about React
001. Introduction about ReactBinh Quan Duc
 
Modern javascript
Modern javascriptModern javascript
Modern javascriptKevin Ball
 
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin CoroutinesThreading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin CoroutinesLauren Yew
 
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ..."Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...Provectus
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueAndrus Adamchik
 
Learning React - I
Learning React - ILearning React - I
Learning React - IMitch Chen
 
Java EE revisits design patterns
Java EE revisits design patterns Java EE revisits design patterns
Java EE revisits design patterns Alex Theedom
 

Was ist angesagt? (20)

React introduction
React introductionReact introduction
React introduction
 
Azkaban
AzkabanAzkaban
Azkaban
 
Flux architecture
Flux architectureFlux architecture
Flux architecture
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOM
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to react
 
Flux
FluxFlux
Flux
 
Flux architecture
Flux architectureFlux architecture
Flux architecture
 
Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)
 
Thinking in React
Thinking in ReactThinking in React
Thinking in React
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
001. Introduction about React
001. Introduction about React001. Introduction about React
001. Introduction about React
 
Modern javascript
Modern javascriptModern javascript
Modern javascript
 
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin CoroutinesThreading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
 
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ..."Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...
"Introduction to Sparkling Water" — Jakub Hava, Senior Software Engineer, at ...
 
Uniqueness of java
Uniqueness of javaUniqueness of java
Uniqueness of java
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with Bootique
 
React101 v3
React101 v3React101 v3
React101 v3
 
Learning React - I
Learning React - ILearning React - I
Learning React - I
 
Agile sites2
Agile sites2Agile sites2
Agile sites2
 
Java EE revisits design patterns
Java EE revisits design patterns Java EE revisits design patterns
Java EE revisits design patterns
 

Andere mochten auch

Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftSeyhun AKYUREK
 
Designing applications with Redux
Designing applications with ReduxDesigning applications with Redux
Designing applications with ReduxFernando Daciuk
 
Into the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional ProgrammingInto the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional ProgrammingMike Pence
 
Understanding Redux — Ilya Gelman
Understanding Redux — Ilya GelmanUnderstanding Redux — Ilya Gelman
Understanding Redux — Ilya Gelman500Tech
 
Dumb and smart components + redux (1)
Dumb and smart components + redux (1)Dumb and smart components + redux (1)
Dumb and smart components + redux (1)Brecht Billiet
 
Application architecture doesn't have to suck
Application architecture doesn't have to suckApplication architecture doesn't have to suck
Application architecture doesn't have to suckjtregunna
 
JavaScript in Mobile Development
JavaScript in Mobile DevelopmentJavaScript in Mobile Development
JavaScript in Mobile DevelopmentDima Maleev
 
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...NoSQLmatters
 
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@LohikaAWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@LohikaSerhiy Batyuk
 
'Did He Really Say That?" effective component communication
'Did He Really Say That?" effective component communication'Did He Really Say That?" effective component communication
'Did He Really Say That?" effective component communicationGus Sabatino
 
Spark - Migration Story
Spark - Migration Story Spark - Migration Story
Spark - Migration Story Roman Chukh
 
Big data analysis in java world
Big data analysis in java worldBig data analysis in java world
Big data analysis in java worldSerg Masyutin
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projectsDmitriy Dumanskiy
 
Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Astrails
 
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчик
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчикХитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчик
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчикNick Grachov
 

Andere mochten auch (20)

Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in Swift
 
Designing applications with Redux
Designing applications with ReduxDesigning applications with Redux
Designing applications with Redux
 
Flux and redux
Flux and reduxFlux and redux
Flux and redux
 
Into the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional ProgrammingInto the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional Programming
 
Reducers+flux=redux
Reducers+flux=reduxReducers+flux=redux
Reducers+flux=redux
 
Understanding Redux — Ilya Gelman
Understanding Redux — Ilya GelmanUnderstanding Redux — Ilya Gelman
Understanding Redux — Ilya Gelman
 
Redux vs Alt
Redux vs AltRedux vs Alt
Redux vs Alt
 
Dumb and smart components + redux (1)
Dumb and smart components + redux (1)Dumb and smart components + redux (1)
Dumb and smart components + redux (1)
 
Application architecture doesn't have to suck
Application architecture doesn't have to suckApplication architecture doesn't have to suck
Application architecture doesn't have to suck
 
JavaScript in Mobile Development
JavaScript in Mobile DevelopmentJavaScript in Mobile Development
JavaScript in Mobile Development
 
Creation of ideas
Creation of ideasCreation of ideas
Creation of ideas
 
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
 
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@LohikaAWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
 
'Did He Really Say That?" effective component communication
'Did He Really Say That?" effective component communication'Did He Really Say That?" effective component communication
'Did He Really Say That?" effective component communication
 
Spark - Migration Story
Spark - Migration Story Spark - Migration Story
Spark - Migration Story
 
Big data analysis in java world
Big data analysis in java worldBig data analysis in java world
Big data analysis in java world
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projects
 
Apache HBase Workshop
Apache HBase WorkshopApache HBase Workshop
Apache HBase Workshop
 
Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.
 
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчик
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчикХитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчик
Хитрости UX-дизайна: ключевые лайфхаки, которые должен знать разработчик
 

Ähnlich wie React. Flux. Redux

ASP.NET Core Demos Part 2
ASP.NET Core Demos Part 2ASP.NET Core Demos Part 2
ASP.NET Core Demos Part 2Erik Noren
 
Code refactoring
Code refactoringCode refactoring
Code refactoringLalit Kale
 
From silex to symfony and viceversa
From silex to symfony and viceversaFrom silex to symfony and viceversa
From silex to symfony and viceversaRonny López
 
Will React Hooks replace Redux?
Will React Hooks replace Redux?Will React Hooks replace Redux?
Will React Hooks replace Redux?Trivikram Kamat
 
Using The Right Tool For The Job
Using The Right Tool For The JobUsing The Right Tool For The Job
Using The Right Tool For The JobChris Baldock
 
Introduction to g reg 4.6.0
Introduction to g reg 4.6.0Introduction to g reg 4.6.0
Introduction to g reg 4.6.0WSO2
 
DevOps+Data: Working with Source Control
DevOps+Data: Working with Source ControlDevOps+Data: Working with Source Control
DevOps+Data: Working with Source ControlEd Leighton-Dick
 
Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19Markus Eisele
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with reduxMike Melusky
 
Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2Mike Melusky
 
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryDOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryGene Kim
 
Software operability and run book collaboration London Feb 2014
Software operability and run book collaboration London Feb 2014Software operability and run book collaboration London Feb 2014
Software operability and run book collaboration London Feb 2014Matthew Skelton
 
Software operability and run book collaboration - DevOps Summit, Bangalore
Software operability and run book collaboration - DevOps Summit, BangaloreSoftware operability and run book collaboration - DevOps Summit, Bangalore
Software operability and run book collaboration - DevOps Summit, BangaloreMatthew Skelton
 
Architecture Principles CodeStock
Architecture Principles CodeStock Architecture Principles CodeStock
Architecture Principles CodeStock Steve Barbour
 
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 ReviewBlockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 ReviewRobert van Mölken
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React EcosystemFITC
 
Improving the Design of Existing Software
Improving the Design of Existing SoftwareImproving the Design of Existing Software
Improving the Design of Existing SoftwareSteven Smith
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"LogeekNightUkraine
 

Ähnlich wie React. Flux. Redux (20)

ASP.NET Core Demos Part 2
ASP.NET Core Demos Part 2ASP.NET Core Demos Part 2
ASP.NET Core Demos Part 2
 
Meteor + React
Meteor + ReactMeteor + React
Meteor + React
 
Code refactoring
Code refactoringCode refactoring
Code refactoring
 
From silex to symfony and viceversa
From silex to symfony and viceversaFrom silex to symfony and viceversa
From silex to symfony and viceversa
 
Will React Hooks replace Redux?
Will React Hooks replace Redux?Will React Hooks replace Redux?
Will React Hooks replace Redux?
 
Using The Right Tool For The Job
Using The Right Tool For The JobUsing The Right Tool For The Job
Using The Right Tool For The Job
 
Introduction to g reg 4.6.0
Introduction to g reg 4.6.0Introduction to g reg 4.6.0
Introduction to g reg 4.6.0
 
DevOps+Data: Working with Source Control
DevOps+Data: Working with Source ControlDevOps+Data: Working with Source Control
DevOps+Data: Working with Source Control
 
Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19Streaming to a new Jakarta EE / JOTB19
Streaming to a new Jakarta EE / JOTB19
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
 
Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2Reactive Web Development with Spring Boot 2
Reactive Web Development with Spring Boot 2
 
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryDOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
 
Software operability and run book collaboration London Feb 2014
Software operability and run book collaboration London Feb 2014Software operability and run book collaboration London Feb 2014
Software operability and run book collaboration London Feb 2014
 
Software operability and run book collaboration - DevOps Summit, Bangalore
Software operability and run book collaboration - DevOps Summit, BangaloreSoftware operability and run book collaboration - DevOps Summit, Bangalore
Software operability and run book collaboration - DevOps Summit, Bangalore
 
Architecture Principles CodeStock
Architecture Principles CodeStock Architecture Principles CodeStock
Architecture Principles CodeStock
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 ReviewBlockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
Blockchain, Integration, Serverless, Microservices - OOW / Code One 2018 Review
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
 
Improving the Design of Existing Software
Improving the Design of Existing SoftwareImproving the Design of Existing Software
Improving the Design of Existing Software
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"
 

Kürzlich hochgeladen

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Kürzlich hochgeladen (20)

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

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

Hinweis der Redaktion

  1. JQuery: event driven pre SPA Complex Apps are hell to write and support
  2. Introduced MVC Designed for SPA Declarative events Works with any view engine Marionette: Message Bus Different View types
  3. Framework Exposes MVW Designed for SPA Introduces a lot of concepts Unit testable
  4. 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
  5. 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
  6. 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
  7. 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?
  8. 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
  9. 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
  10. So what that brings: Same data produces same view output Data changes are predictable and easier to track related changes
  11. 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