SlideShare une entreprise Scribd logo
1  sur  18
React stack
@Lozi
lozi.vn
The front-end heaven
- New libraries everyday
- Project gets old after a few months
- You quickly become old-fashioned man/woman
2
The front-end heaven
- New libraries everyday
- Project gets old after a few months
- You quickly become old-fashioned man/woman
=> https://uptodate.frontendrescue.org/
3
React stack @Lozi
1. Isomorphic App
2. Trinity Force: React, React Router & Redux
3. Self-aware Component
4
by Thinh Nguyen Cuong - cuongthinh@lozi.vn
Web Developer at Lozi.vn
1. Isomorphic App
5
"Isomorphism is the functional aspect of
seamlessly switching between client- and
server-side rendering without losing state."
Source: https://reactjsnews.com/isomorphic-react-in-real-life
Concept
"Universal is a term used to emphasize the fact
that a particular piece of JavaScript code is
able to run in multiple environments."
@ghengeveld on Medium
1. Isomorphic App
6
Server-side Client-side
The kind-of Isomorphic React App
1. Isomorphic App
7
Source: https://reactjsnews.com/isomorphic-react-in-real-life
Concept Real life
8
Flummox: Nice and friendly and do-whatever-you-want Flux
⇒ Anti-pattern: “Cannot dispatch in a middle of a dispatch” a.k.a. Hard to make side effects
⇒ Hard to debug: data comes from nowhere
⇒ Took a lot of time to get on with the project, then to add new features
.
.
.
Life at Lozi before web v3.0
2. Trinity Force: React-React Router-Redux
9
React & React Router: API changes on each release, which
encourages you to build a new app, rather than upgrade the old one
2. Trinity Force: React-React Router-Redux
10
TONS OF
DAMAGE!!
React & React Router: API changes on each release, which
encourages you to build a new app, rather than upgrade the old one
Redux: Keeps you on the right track!
⇒ Completely “predictable”
⇒ Hot reloading & Time travel with Redux Devtool
⇒ Flummox’s creator (@acdlite) recommends Redux
2. Trinity Force: React-React Router-Redux
11
Source: http://slides.com/jenyaterpil/redux-from-twitter-hype-to-production
3. Self-aware Component?
12
Repeating this all the time
3. Self-aware Component?
A component that:
- Is a base component to be extended
- Can check if it has data in store
- Can fetch data from api on its own
- Decide to render itself, based on data status in store
13
3. Self-aware Component
The base class injects code into the overridden method from the subclass, to do additional tasks.
14
3. Self-aware Component
The base class injects code into the overridden method from the subclass, to do additional tasks.
15
3. Self-aware Component
The base class injects code into the overridden method from the subclass, to do additional tasks.
16
The same with componentDidUpdate()
3. Self-aware Component
Self-aware Component required props:
- actionCreator(): Redux’s action object, API is fetched here
- dataGetter(): used in Redux’s connect() to get the specific data from the store
- params: used as params for actionCreator & dataGetter
17
3. Self-aware Component
But first, the component needs to be wrapped by Redux’s connect() so it can access the data.
18
A custom mapStateToProps() will execute dataGetter() to get the data for the component

Contenu connexe

Tendances

Tendances (20)

Please Upgrade Apache Kafka. Now. (Gwen Shapira, Confluent) Kafka Summit SF 2019
Please Upgrade Apache Kafka. Now. (Gwen Shapira, Confluent) Kafka Summit SF 2019Please Upgrade Apache Kafka. Now. (Gwen Shapira, Confluent) Kafka Summit SF 2019
Please Upgrade Apache Kafka. Now. (Gwen Shapira, Confluent) Kafka Summit SF 2019
 
Kafka Connect
Kafka ConnectKafka Connect
Kafka Connect
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Kafka 101 - Meetup Kafka BR - Oracle
Kafka 101 - Meetup Kafka BR - OracleKafka 101 - Meetup Kafka BR - Oracle
Kafka 101 - Meetup Kafka BR - Oracle
 
Confluent building a real-time streaming platform using kafka streams and k...
Confluent   building a real-time streaming platform using kafka streams and k...Confluent   building a real-time streaming platform using kafka streams and k...
Confluent building a real-time streaming platform using kafka streams and k...
 
APACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka StreamsAPACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka Streams
 
Kafka internals
Kafka internalsKafka internals
Kafka internals
 
Kafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internalsKafka blr-meetup-presentation - Kafka internals
Kafka blr-meetup-presentation - Kafka internals
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Fundamentals of Apache Kafka
Fundamentals of Apache KafkaFundamentals of Apache Kafka
Fundamentals of Apache Kafka
 
Kube 101
Kube 101Kube 101
Kube 101
 
How Splunk Is Using Pulsar IO
How Splunk Is Using Pulsar IOHow Splunk Is Using Pulsar IO
How Splunk Is Using Pulsar IO
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Introduction to apache kafka
Introduction to apache kafkaIntroduction to apache kafka
Introduction to apache kafka
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 
stigbot_beta
stigbot_betastigbot_beta
stigbot_beta
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Building Linux IPv6 DNS Server (Third Review)
Building Linux IPv6 DNS Server (Third Review)Building Linux IPv6 DNS Server (Third Review)
Building Linux IPv6 DNS Server (Third Review)
 
Until Successful Scope With Mule ESB
Until Successful Scope With Mule ESBUntil Successful Scope With Mule ESB
Until Successful Scope With Mule ESB
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 

En vedette

Hotel Vermont and Community Entrepreneurship (v2)
Hotel Vermont and Community Entrepreneurship (v2)Hotel Vermont and Community Entrepreneurship (v2)
Hotel Vermont and Community Entrepreneurship (v2)
hansvw
 

En vedette (13)

Grokking TechTalk #16: F**k bad CSS
Grokking TechTalk #16: F**k bad CSSGrokking TechTalk #16: F**k bad CSS
Grokking TechTalk #16: F**k bad CSS
 
Grokking TechTalk #16: Maybe functor in javascript
Grokking TechTalk #16: Maybe functor in javascriptGrokking TechTalk #16: Maybe functor in javascript
Grokking TechTalk #16: Maybe functor in javascript
 
Grokking TechTalk #16: Html js and three way binding
Grokking TechTalk #16: Html js and three way bindingGrokking TechTalk #16: Html js and three way binding
Grokking TechTalk #16: Html js and three way binding
 
Grokking: Data Engineering Course
Grokking: Data Engineering CourseGrokking: Data Engineering Course
Grokking: Data Engineering Course
 
TechTalk #15 Grokking: The data processing journey at AhaMove
TechTalk #15 Grokking:  The data processing journey at AhaMoveTechTalk #15 Grokking:  The data processing journey at AhaMove
TechTalk #15 Grokking: The data processing journey at AhaMove
 
Responsive emails and ZURB Foundation for email
Responsive emails and ZURB Foundation for emailResponsive emails and ZURB Foundation for email
Responsive emails and ZURB Foundation for email
 
TDC São Paulo - React presentation
TDC São Paulo - React presentationTDC São Paulo - React presentation
TDC São Paulo - React presentation
 
Hotel Vermont and Community Entrepreneurship (v2)
Hotel Vermont and Community Entrepreneurship (v2)Hotel Vermont and Community Entrepreneurship (v2)
Hotel Vermont and Community Entrepreneurship (v2)
 
La Familia
La FamiliaLa Familia
La Familia
 
Energias no renovables
Energias no renovablesEnergias no renovables
Energias no renovables
 
10 Weird Bans Around The World
10 Weird Bans Around The World10 Weird Bans Around The World
10 Weird Bans Around The World
 
Employee advocacy - guide opérationnel
Employee advocacy - guide opérationnelEmployee advocacy - guide opérationnel
Employee advocacy - guide opérationnel
 
Breaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactBreaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and React
 

Similaire à Grokking TechTalk #16: React stack at lozi

Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 

Similaire à Grokking TechTalk #16: React stack at lozi (20)

GITS Class #20: Building A Fast and Responsive UI in React Native
GITS Class #20: Building A Fast and Responsive UI in React NativeGITS Class #20: Building A Fast and Responsive UI in React Native
GITS Class #20: Building A Fast and Responsive UI in React Native
 
React gsg presentation with ryan jung & elias malik
React   gsg presentation with ryan jung & elias malikReact   gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malik
 
Redux
ReduxRedux
Redux
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
A React Journey
A React JourneyA React Journey
A React Journey
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and Redux
 
React native
React nativeReact native
React native
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJS
 
Presentation1
Presentation1Presentation1
Presentation1
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
How to implement Micro-frontends using Qiankun
How to implement Micro-frontends using QiankunHow to implement Micro-frontends using Qiankun
How to implement Micro-frontends using Qiankun
 
Client-side Development 2016
Client-side Development 2016Client-side Development 2016
Client-side Development 2016
 
JOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and ReduxJOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and Redux
 
Plone FSR
Plone FSRPlone FSR
Plone FSR
 
Reactive web applications
Reactive web applicationsReactive web applications
Reactive web applications
 
an Introduction to Redux
an Introduction to Reduxan Introduction to Redux
an Introduction to Redux
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Adventures building 3 realtime single-page apps 6 different ways
Adventures building 3 realtime single-page apps 6 different waysAdventures building 3 realtime single-page apps 6 different ways
Adventures building 3 realtime single-page apps 6 different ways
 
Strange Async Code - ReaxtiveX
Strange Async Code - ReaxtiveXStrange Async Code - ReaxtiveX
Strange Async Code - ReaxtiveX
 

Plus de Grokking VN

Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banksGrokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking VN
 
Grokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles ThinkingGrokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles Thinking
Grokking VN
 
Grokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystifiedGrokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystified
Grokking VN
 
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
 Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer... Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
Grokking VN
 

Plus de Grokking VN (20)

Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banksGrokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
 
Grokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles ThinkingGrokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles Thinking
 
Grokking Techtalk #42: Engineering challenges on building data platform for M...
Grokking Techtalk #42: Engineering challenges on building data platform for M...Grokking Techtalk #42: Engineering challenges on building data platform for M...
Grokking Techtalk #42: Engineering challenges on building data platform for M...
 
Grokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystifiedGrokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystified
 
Grokking Techtalk #40: Consistency and Availability tradeoff in database cluster
Grokking Techtalk #40: Consistency and Availability tradeoff in database clusterGrokking Techtalk #40: Consistency and Availability tradeoff in database cluster
Grokking Techtalk #40: Consistency and Availability tradeoff in database cluster
 
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platform
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platformGrokking Techtalk #40: AWS’s philosophy on designing MLOps platform
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platform
 
Grokking Techtalk #39: Gossip protocol and applications
Grokking Techtalk #39: Gossip protocol and applicationsGrokking Techtalk #39: Gossip protocol and applications
Grokking Techtalk #39: Gossip protocol and applications
 
Grokking Techtalk #39: How to build an event driven architecture with Kafka ...
 Grokking Techtalk #39: How to build an event driven architecture with Kafka ... Grokking Techtalk #39: How to build an event driven architecture with Kafka ...
Grokking Techtalk #39: How to build an event driven architecture with Kafka ...
 
Grokking Techtalk #38: Escape Analysis in Go compiler
 Grokking Techtalk #38: Escape Analysis in Go compiler Grokking Techtalk #38: Escape Analysis in Go compiler
Grokking Techtalk #38: Escape Analysis in Go compiler
 
Grokking Techtalk #37: Data intensive problem
 Grokking Techtalk #37: Data intensive problem Grokking Techtalk #37: Data intensive problem
Grokking Techtalk #37: Data intensive problem
 
Grokking Techtalk #37: Software design and refactoring
 Grokking Techtalk #37: Software design and refactoring Grokking Techtalk #37: Software design and refactoring
Grokking Techtalk #37: Software design and refactoring
 
Grokking TechTalk #35: Efficient spellchecking
Grokking TechTalk #35: Efficient spellcheckingGrokking TechTalk #35: Efficient spellchecking
Grokking TechTalk #35: Efficient spellchecking
 
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
 Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer... Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
 
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
 
SOLID & Design Patterns
SOLID & Design PatternsSOLID & Design Patterns
SOLID & Design Patterns
 
Grokking TechTalk #31: Asynchronous Communications
Grokking TechTalk #31: Asynchronous CommunicationsGrokking TechTalk #31: Asynchronous Communications
Grokking TechTalk #31: Asynchronous Communications
 
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at ScaleGrokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
 
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedInGrokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
 
Grokking TechTalk #27: Optimal Binary Search Tree
Grokking TechTalk #27: Optimal Binary Search TreeGrokking TechTalk #27: Optimal Binary Search Tree
Grokking TechTalk #27: Optimal Binary Search Tree
 

Dernier

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Grokking TechTalk #16: React stack at lozi

  • 2. The front-end heaven - New libraries everyday - Project gets old after a few months - You quickly become old-fashioned man/woman 2
  • 3. The front-end heaven - New libraries everyday - Project gets old after a few months - You quickly become old-fashioned man/woman => https://uptodate.frontendrescue.org/ 3
  • 4. React stack @Lozi 1. Isomorphic App 2. Trinity Force: React, React Router & Redux 3. Self-aware Component 4 by Thinh Nguyen Cuong - cuongthinh@lozi.vn Web Developer at Lozi.vn
  • 5. 1. Isomorphic App 5 "Isomorphism is the functional aspect of seamlessly switching between client- and server-side rendering without losing state." Source: https://reactjsnews.com/isomorphic-react-in-real-life Concept "Universal is a term used to emphasize the fact that a particular piece of JavaScript code is able to run in multiple environments." @ghengeveld on Medium
  • 6. 1. Isomorphic App 6 Server-side Client-side The kind-of Isomorphic React App
  • 7. 1. Isomorphic App 7 Source: https://reactjsnews.com/isomorphic-react-in-real-life Concept Real life
  • 8. 8 Flummox: Nice and friendly and do-whatever-you-want Flux ⇒ Anti-pattern: “Cannot dispatch in a middle of a dispatch” a.k.a. Hard to make side effects ⇒ Hard to debug: data comes from nowhere ⇒ Took a lot of time to get on with the project, then to add new features . . . Life at Lozi before web v3.0
  • 9. 2. Trinity Force: React-React Router-Redux 9 React & React Router: API changes on each release, which encourages you to build a new app, rather than upgrade the old one
  • 10. 2. Trinity Force: React-React Router-Redux 10 TONS OF DAMAGE!! React & React Router: API changes on each release, which encourages you to build a new app, rather than upgrade the old one Redux: Keeps you on the right track! ⇒ Completely “predictable” ⇒ Hot reloading & Time travel with Redux Devtool ⇒ Flummox’s creator (@acdlite) recommends Redux
  • 11. 2. Trinity Force: React-React Router-Redux 11 Source: http://slides.com/jenyaterpil/redux-from-twitter-hype-to-production
  • 13. 3. Self-aware Component? A component that: - Is a base component to be extended - Can check if it has data in store - Can fetch data from api on its own - Decide to render itself, based on data status in store 13
  • 14. 3. Self-aware Component The base class injects code into the overridden method from the subclass, to do additional tasks. 14
  • 15. 3. Self-aware Component The base class injects code into the overridden method from the subclass, to do additional tasks. 15
  • 16. 3. Self-aware Component The base class injects code into the overridden method from the subclass, to do additional tasks. 16 The same with componentDidUpdate()
  • 17. 3. Self-aware Component Self-aware Component required props: - actionCreator(): Redux’s action object, API is fetched here - dataGetter(): used in Redux’s connect() to get the specific data from the store - params: used as params for actionCreator & dataGetter 17
  • 18. 3. Self-aware Component But first, the component needs to be wrapped by Redux’s connect() so it can access the data. 18 A custom mapStateToProps() will execute dataGetter() to get the data for the component