Upgrade to Pro — share decks privately, control downloads, hide ads and more …

From Backbone.Views To ReactJs

From Backbone.Views To ReactJs

528c708e08d6011fc90d3e17876c65b9?s=128

Sarmad Sangi

April 28, 2014
Tweet

Transcript

  1. By Sarmad Sangi From Backbone.Views to ReactJs

  2. Problem with backbone views • Nested Backbone.View 's are hard

    to maintain (ie lifecycle). • Every time collection changes it re-renders all the views.
  3. Solution ?

  4. What is ReactJs ? • JS Lib for building UI

    Components • Virtual DOM for ultra-high performance
  5. Who is using it ? • Facebook (comments, like etc)

    • Instagram (Main Page) • Khan Academy (200 components)
  6. React Components React.createClass({ render: function () { return React.DOM.div({}, Everything

    is awesome!); } }); OR //jsx lah React.createClass({ render: function () { return <div>Everything is awesome!</div>; } });
  7. React In Action https://github.com/sarmadsangi/backbone_to_reactjs/

  8. React Tips • class -> className • Elements within render

    must have parent element • Don't use minified version in development env • Data flows from parent to child • Move component by component, both backbone views and react components can co-exist in one app.
  9. Not satisfied yet? References http://www.quora.com/Pete-Hunt/Posts/React-Convincing-the-Boss http://facebook.github.io/react/docs/thinking-in-react.html http://joelburget.com/backbone-to-react/ Demo Source Code

    https://github.com/sarmadsangi/backbone_to_reactjs