React JS


goo.gl/kT9znz





MD Khan / @mdkhan005

www.thatjsdude.com

JS is always hot



  • 2012-Backbone is so hot
  • 2014-Angular is so hot
  • 2015-React is so hot

Why React?

  • Fast
  • Pluggable
  • Virtual DOM
  • JSX
  • Isomorphic Rendering
  • Unidirectional Flow

Virtual DOM

  • Compare DOM's current state to desired new state
  • Update the DOM in the most efficient way
  • Synthetic Events
  • Isomorphic Support
  • React Native

JSX

  • "HTML" in JavaScript
  • Differences: className, htmlFor
  • Compiles to JavaScript
  • Inline style can be good
  • Optional

Why JSX

  • Angular, Ember, knockout uses "JS" in HTML
  • <div ng-repeat ="user in users">
  • {{#each user in users}}
  • HTML doesn't tell typo in HTML
  • JS will throws error in the line it happens

Let's Check it out

One step at a time



  • First step - absolute beginners
  • Second step - small app
  • Third step - grid and charts
  • Fourth step - large app



Simple application with React

Try it out

Grid & Charts

React Grid Libraries

Life cycle methods

  • componentWillMount
  • componentDidMount
  • componentWillRecieveProps
  • shouldComponentUpdate
  • componentWillUpdate
  • componentDidUpdate
  • compnentWillUnmount


component spec

Charts



react-d3
react-nvd3

React Router

  • Complete routing library
  • Simple api
  • Lazy loading
  • Dynamic route matching
  • Location transition handling


react-router

Large application

Flux

  • Architecture recommendation by facebook
  • Uni directional data flow
  • View, dispatcher, store, event emitter



flux overview
simple app by using flux

Flux flow

Redux



react, flux and a little bit redux

Relay



Relay: data driver react

Starter kit


Google React Starter Kit
cortex deeply nested data store

React Dev tool

  • Color coded Tree view
  • Search
  • Change state props



React dev tool
UI testing with React
redux dev tool

Unit Test

Debug more

Need more?

Thank You


goo.gl/kT9znz



MD Khan / @mdkhan005
www.thatjsdude.com

Question?


goo.gl/0JIpFe

MD Khan / @mdkhan005
www.thatjsdude.com