Learning React - I 
Senior Front-End Manager 
Mitch Chen
Outline 
• Showcase 
• Overview 
• Tutorial 
• Where To Go From Here 
• Q & A
Showcase 
• Facebook 
• Instagram 
• Khan Academy 
• The New York Times 
• Mobile Web App
Facebook Lookback Video
Instagram
Khan Academy
NYTimes
Overview 
• What is React? 
• Why React Rock? 
• Components, Not Templates 
• Re-render 
• Virtual DOM
What Is React ?
• A Library for creating user interfaces 
• Not yet another JS framework 
• Renders your UI and responds to Events 
• Aka: The V in MVC
Why React Rock?
• Battle-tested on Facebook and Instagram 
• Building Large Applications with data that 
changes over time 
• Components are so Encapsulated, make code 
Reuse, Testing and Separation of Concerns 
easy 
• Browser support back to IE8
Components, Not Templates
• Separation of Concerns: 
Reduce Coupling, increase Cohesion 
• Components are the right way to separate concerns 
• Display Logic and Markup are highly Cohesive: 
They both show the UI 
• React component use Expressive power of programming 
language(JSX) to build UIs 
• React component: 
A highly Cohesive building block for UIs Loosely Coupled 
with other components
• Components are Reusable, Composable and 
Unit Testable 
• Build many simple components that does 
one thing really well 
• Then compose them into a bigger functional 
unit 
• Which allows you to structure the application 
better with more flexibility
Re-Render
• State has data you own, Props has data you 
borrow 
• When the state(data) changes, React Re-renders 
the Entire Component 
• No magical data binding 
• No model dirty checking 
• No more explicit DOM operations: 
Everything is declarative
ReactJS v.s. AngularJS
Data flow when a user event results in a DOM update
Virtual DOM
Traditional 
Web App 
React 
Web App
• Makes re-rendering on every change fast 
• Computes minimal DOM operations 
• Batched reads and writes for optimal DOM 
performance 
• Usually faster than manual DOM operations 
• 60fps, even in a UIWebView on the iPhone
React V.S. Doom 3 
Doom 3 
React
On Every Update… 
• React builds a new virtual DOM 
subtree 
• Diff it with the old one 
• Computes the minimal set of DOM 
mutations and puts them in a queue 
• Batch executes all updates
Tutorial 
• Example: Youtube Most Popular
Where To Go From Here 
• React JSX 
• State and Props 
• Component Specifications and Lifecycle 
• Communicate Between Components 
• Flux v.s. MVC 
• ……
Q & A
Reference 
http://facebook.github.io/react/ 
http://www.slideshare.net/floydophone/react-preso-v2 
http://www.funnyant.com/reactjs-what-is-it/ 
http://calendar.perfplanet.com/2013/diff/ 
http://lincolnloop.com/blog/architecting-your-app-react-part- 
1/

Learning React - I

  • 1.
    Learning React -I Senior Front-End Manager Mitch Chen
  • 2.
    Outline • Showcase • Overview • Tutorial • Where To Go From Here • Q & A
  • 3.
    Showcase • Facebook • Instagram • Khan Academy • The New York Times • Mobile Web App
  • 4.
  • 5.
  • 6.
  • 7.
  • 10.
    Overview • Whatis React? • Why React Rock? • Components, Not Templates • Re-render • Virtual DOM
  • 11.
  • 12.
    • A Libraryfor creating user interfaces • Not yet another JS framework • Renders your UI and responds to Events • Aka: The V in MVC
  • 13.
  • 14.
    • Battle-tested onFacebook and Instagram • Building Large Applications with data that changes over time • Components are so Encapsulated, make code Reuse, Testing and Separation of Concerns easy • Browser support back to IE8
  • 15.
  • 16.
    • Separation ofConcerns: Reduce Coupling, increase Cohesion • Components are the right way to separate concerns • Display Logic and Markup are highly Cohesive: They both show the UI • React component use Expressive power of programming language(JSX) to build UIs • React component: A highly Cohesive building block for UIs Loosely Coupled with other components
  • 17.
    • Components areReusable, Composable and Unit Testable • Build many simple components that does one thing really well • Then compose them into a bigger functional unit • Which allows you to structure the application better with more flexibility
  • 20.
  • 21.
    • State hasdata you own, Props has data you borrow • When the state(data) changes, React Re-renders the Entire Component • No magical data binding • No model dirty checking • No more explicit DOM operations: Everything is declarative
  • 22.
  • 23.
    Data flow whena user event results in a DOM update
  • 24.
  • 25.
    Traditional Web App React Web App
  • 26.
    • Makes re-renderingon every change fast • Computes minimal DOM operations • Batched reads and writes for optimal DOM performance • Usually faster than manual DOM operations • 60fps, even in a UIWebView on the iPhone
  • 28.
    React V.S. Doom3 Doom 3 React
  • 29.
    On Every Update… • React builds a new virtual DOM subtree • Diff it with the old one • Computes the minimal set of DOM mutations and puts them in a queue • Batch executes all updates
  • 30.
    Tutorial • Example:Youtube Most Popular
  • 32.
    Where To GoFrom Here • React JSX • State and Props • Component Specifications and Lifecycle • Communicate Between Components • Flux v.s. MVC • ……
  • 33.
  • 34.
    Reference http://facebook.github.io/react/ http://www.slideshare.net/floydophone/react-preso-v2 http://www.funnyant.com/reactjs-what-is-it/ http://calendar.perfplanet.com/2013/diff/ http://lincolnloop.com/blog/architecting-your-app-react-part- 1/