React Slowly – And Still End Up Fast



React Slowly – And Still End Up Fast

0 0


react-slowly-talk

A presentation given at SilverStripe Auckland's October 2015 Meetup

On Github stevie-mayhew / react-slowly-talk

React Slowly

And Still End Up Fast

Who Am I?

Stevie Mayhew CTO @ Little Giant

stevie.mayhew@littlegiant.co.nz

React to what?

  • ReactJS
  • Facebook Backed
  • Originally released 2013
  • Currently version 0.14.0

My History

  • First time playing around React 0.8.0
  • Still actively maintain others code written in React 0.8.0
  • First code contribution April 2014 - react-bootstrap
  • First code I personally wrote in production September 2014 - React 0.10.0

Why React?

  • Easy to reason about
  • Components are reusable
  • Large ecosystem of developers
  • Makes sense for larger stateful applications
  • We don't use it everywhere!

Slowly moving forward

  • Reasonable to build small components for your websites
  • Start with something non-critical

Don't forget to think about it though

  • Dumping data onto the page to load via `data` attributes
    • Not practical
    • Not scalable
    • Not reasonable
    • Not my problem
  • API to retrieve all the data at once
  • API to retrieve data on load
  • API to retrieve data preemptively

API Options

  • RestfulServer (https://github.com/silverstripe/silverstripe-restfulserver)
  • RESTful API (https://github.com/colymba/silverstripe-restfulapi)
  • Roll your own (https://github.com/your-name-here/silverstripe-awesomeapi)

React Options

  • Pure
  • Flux
    • Redux
    • Predictable state containment
    • Everything we write is now using this pattern
    • Think its crazy to do without it
  • Immutable.js is also a good idea

A note on build systems

  • Grunt (slow)
  • Gulp (medium)
  • Webpack (fast)

Live Code Example

Uh oh.

THE END

Thanks for listening.

Further reading

  • https://facebook.github.io/react/
  • https://facebook.github.io/react/docs/getting-started.html
  • https://webpack.github.io/
  • https://github.com/rackt/redux
  • https://github.com/rackt/react-redux
  • https://facebook.github.io/immutable-js/

Questions?

React Slowly And Still End Up Fast