SlideShare una empresa de Scribd logo
1 de 16
Descargar para leer sin conexión
© 2016 Move, Inc. All rights reserved. Do not copy or distribute. 1
ReactJS - Front End
migration story @
Realtor.com
Khanh Dao
1/26/2018
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
● A walk down memory lane
● Technical Debt
● ReactJS to rescue?
● Deep dive and lesson learned
● Q&A
Agenda
2
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
Recalling the past...
3
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
● NodeJS/NPM system
● Custom Bootstrap
● jQuery and plugins
● DustJS
● Bimo
● PubSub pattern
Recalling the past…(cont.)
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
● Large scale UI component and modular support
● When application grow larger, heavy DOM
manipulation slow down client rendering and
performance.
● Lacking of data management system that should only
change the data needed to be change on DOM
rendering, state management of data is confusing.
Why didn’t it work for us?
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
“React makes it painless to create interactive UIs.
Design simple views for each state in your application,
and React will efficiently update and render just the
right components when your data changes.”
Reference: https://reactjs.org/
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
● Abstraction of actual
HTML DOM
● Store state independent
of the DOM and allow
compare to the DOM
What is a Virtual
DOM?
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
Prop:
● Parameter to a function
● React.PropTypes is used for
data sanitization
States
● Hold the current state inside
component
○ getInitialState
○ setState
Ref
● Keep reference to component
Prop, State, Ref
class Button extends React.Component {
constructor() {
super();
this.state = {
count: 0,
};
}
updateCount() {
this.setState((prevState, props) => {
return { count: prevState.count + 1 }
});
}
render() {
return (
<button onClick={() => this.updateCount()}>
{this.props.name}: {this.state.count}
</button>);
}
}
ReactDOM.render(<Button name=”Click me” />,
mountNode);
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
https://developmentarc.gitbooks.io/react-indepth/content/life_cycle/the_life_cycle_recap.html
React LifeCycle
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
React
Component
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
● Block of text
● Block of HTML
● Mixture of text and HTML
● A container for other components
What is a Component…?
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
Why Components are important?
● Accelerate development with reusability so you don’t repeat
yourself
● Keep a consistent user experience across pages for the same
parts of your pages
● Optimize requirement and design process
● Speed up the transition from design to development
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
● Presentational components
○ How things look
○ Accept props from container to render HTML block
○ No dependencies with application code
● Container components
○ How things work
○ Behavioral components
Patterns of developing component
© 2016 Move, Inc. All rights reserved. Do not copy or distribute.
- One way directional data flow is definitely produce more stable
and predictable code
- Stable in-house eco system for share and reuse
- Unit test to ensure code quality.
- We’ve developed over 30 presentational UI components and over 8
behavioral components that share across multiple teams
- Faster UX/UI cycle as team can adopt a change in component more
quickly through seamless API interface, while expecting less bugs
React Benefits
THANK
YOU© 2016 Move, Inc. All rights reserved. Do not copy or distribute. 16
khanh.dao@move.com
https://github.com/lelea2

Más contenido relacionado

Similar a ShehackBoston-2018

KharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themKharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themVlad Fedosov
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesJumping Bean
 
Green Custard Friday Talk 21: React Hooks
Green Custard Friday Talk 21: React HooksGreen Custard Friday Talk 21: React Hooks
Green Custard Friday Talk 21: React HooksGreen Custard
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Previewvaluebound
 
Танки в облаках
Танки в облакахТанки в облаках
Танки в облакахOpenStackRussia
 
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptxGet Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptxConcetto Labs
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend DevelopersSergio Nakamura
 
How to tackle technical debt from Product Management perspective
How to tackle technical debt from Product Management perspectiveHow to tackle technical debt from Product Management perspective
How to tackle technical debt from Product Management perspectiveJérôme Joly
 
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechVue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechDivante
 
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]GDSC UofT Mississauga
 
Refactorisation de code : comment l’intégrer à sa roadmap Produit ?
Refactorisation de code : comment l’intégrer à sa roadmap Produit ?Refactorisation de code : comment l’intégrer à sa roadmap Produit ?
Refactorisation de code : comment l’intégrer à sa roadmap Produit ?Thiga
 
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and PatternsFRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and PatternsLeapfrog Technology Inc.
 
Comprehensive Guide to React Development 2022.pptx
Comprehensive Guide to React Development 2022.pptxComprehensive Guide to React Development 2022.pptx
Comprehensive Guide to React Development 2022.pptx75waytechnologies
 
Intro to Flutter
Intro to FlutterIntro to Flutter
Intro to FlutterEason Pai
 
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...Radovan Semancik
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyKhor SoonHin
 
Angular 1.x reloaded: improve your app now! and get ready for 2.0
Angular 1.x reloaded:  improve your app now! and get ready for 2.0Angular 1.x reloaded:  improve your app now! and get ready for 2.0
Angular 1.x reloaded: improve your app now! and get ready for 2.0Carlo Bonamico
 

Similar a ShehackBoston-2018 (20)

KharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themKharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address them
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
 
Green Custard Friday Talk 21: React Hooks
Green Custard Friday Talk 21: React HooksGreen Custard Friday Talk 21: React Hooks
Green Custard Friday Talk 21: React Hooks
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Танки в облаках
Танки в облакахТанки в облаках
Танки в облаках
 
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptxGet Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
How to tackle technical debt from Product Management perspective
How to tackle technical debt from Product Management perspectiveHow to tackle technical debt from Product Management perspective
How to tackle technical debt from Product Management perspective
 
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechVue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
 
React loadable
React loadableReact loadable
React loadable
 
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]
 
Refactorisation de code : comment l’intégrer à sa roadmap Produit ?
Refactorisation de code : comment l’intégrer à sa roadmap Produit ?Refactorisation de code : comment l’intégrer à sa roadmap Produit ?
Refactorisation de code : comment l’intégrer à sa roadmap Produit ?
 
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and PatternsFRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
 
Comprehensive Guide to React Development 2022.pptx
Comprehensive Guide to React Development 2022.pptxComprehensive Guide to React Development 2022.pptx
Comprehensive Guide to React Development 2022.pptx
 
Next.js - ReactPlayIO.pptx
Next.js - ReactPlayIO.pptxNext.js - ReactPlayIO.pptx
Next.js - ReactPlayIO.pptx
 
Intro to Flutter
Intro to FlutterIntro to Flutter
Intro to Flutter
 
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React Family
 
Angular 1.x reloaded: improve your app now! and get ready for 2.0
Angular 1.x reloaded:  improve your app now! and get ready for 2.0Angular 1.x reloaded:  improve your app now! and get ready for 2.0
Angular 1.x reloaded: improve your app now! and get ready for 2.0
 

Último

Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Último (20)

Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

ShehackBoston-2018

  • 1. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. 1 ReactJS - Front End migration story @ Realtor.com Khanh Dao 1/26/2018
  • 2. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. ● A walk down memory lane ● Technical Debt ● ReactJS to rescue? ● Deep dive and lesson learned ● Q&A Agenda 2
  • 3. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. Recalling the past... 3
  • 4. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. ● NodeJS/NPM system ● Custom Bootstrap ● jQuery and plugins ● DustJS ● Bimo ● PubSub pattern Recalling the past…(cont.)
  • 5. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. ● Large scale UI component and modular support ● When application grow larger, heavy DOM manipulation slow down client rendering and performance. ● Lacking of data management system that should only change the data needed to be change on DOM rendering, state management of data is confusing. Why didn’t it work for us?
  • 6. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. “React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.” Reference: https://reactjs.org/
  • 7. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. ● Abstraction of actual HTML DOM ● Store state independent of the DOM and allow compare to the DOM What is a Virtual DOM?
  • 8. © 2016 Move, Inc. All rights reserved. Do not copy or distribute.
  • 9. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. Prop: ● Parameter to a function ● React.PropTypes is used for data sanitization States ● Hold the current state inside component ○ getInitialState ○ setState Ref ● Keep reference to component Prop, State, Ref class Button extends React.Component { constructor() { super(); this.state = { count: 0, }; } updateCount() { this.setState((prevState, props) => { return { count: prevState.count + 1 } }); } render() { return ( <button onClick={() => this.updateCount()}> {this.props.name}: {this.state.count} </button>); } } ReactDOM.render(<Button name=”Click me” />, mountNode);
  • 10. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. https://developmentarc.gitbooks.io/react-indepth/content/life_cycle/the_life_cycle_recap.html React LifeCycle
  • 11. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. React Component
  • 12. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. ● Block of text ● Block of HTML ● Mixture of text and HTML ● A container for other components What is a Component…?
  • 13. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. Why Components are important? ● Accelerate development with reusability so you don’t repeat yourself ● Keep a consistent user experience across pages for the same parts of your pages ● Optimize requirement and design process ● Speed up the transition from design to development
  • 14. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. ● Presentational components ○ How things look ○ Accept props from container to render HTML block ○ No dependencies with application code ● Container components ○ How things work ○ Behavioral components Patterns of developing component
  • 15. © 2016 Move, Inc. All rights reserved. Do not copy or distribute. - One way directional data flow is definitely produce more stable and predictable code - Stable in-house eco system for share and reuse - Unit test to ensure code quality. - We’ve developed over 30 presentational UI components and over 8 behavioral components that share across multiple teams - Faster UX/UI cycle as team can adopt a change in component more quickly through seamless API interface, while expecting less bugs React Benefits
  • 16. THANK YOU© 2016 Move, Inc. All rights reserved. Do not copy or distribute. 16 khanh.dao@move.com https://github.com/lelea2