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

Going cross-platform with React

Hugo
February 02, 2016

Going cross-platform with React

We're going to talk about how to make cross-platform development less painful by leveraging React. This is the lightning talk version :)

Hugo

February 02, 2016
Tweet

More Decks by Hugo

Other Decks in Programming

Transcript

  1. So we need three platforms (at least) Do I know

    all three to a decent level? Does anyone?
  2. USUAL SOLUTIONS Build x4 apps: Time/money cost Only build a

    web/iOS/Android/Desktop app: Business cost Only build a web app and put it everywhere: UX cost
  3. Who do we know that needs to do things fast

    and cross­ platform? Facebook ­ "Move fast and break things"
  4. 1. Wait until app/window is loaded 2. Attach a listener/handler

    combo 3. When event is fired, execute handler
  5. STATE VS UI Every time c o u n t

    e r changes we need to "manually" update all the elements that display it Doesn't scale/increases headaches
  6. BUTTON? B u t t o n b u t

    t o n = ( B u t t o n ) f i n d V i e w B y I d ( R . i d . b u t t o n 1 ) ; v a r b u t t o n = d o c u m e n t . g e t E l e m e n t B y I d ( ' b u t t o n ' ) ; Tight coupling but other half of the code is in another file Doesn't scale/increases headaches
  7. c l a s s B u t t o

    n e x t e n d s R e a c t . C o m p o n e n t { / / E S 6 s y n t a x ? I t h i n k s o c o n s t r u c t o r ( p r o p s ) { s u p e r ( p r o p s ) ; t h i s . s t a t e = { c o u n t e r : 0 ; } } r e n d e r ( ) { r e t u r n ( < d i v o n c l i c k = " { t h i s . h a n d l e C l i c k . b i n d ( t h i s ) } " > { t h i s . s t a t e . c o u n t e r } < / d i v > ) } h a n d l e C l i c k ( ) { t h i s . s e t S t a t e ( { c o u n t e r : t h i s . s t a t e . c o u n t e r + 1 } ) ; } } Component­contained State Declarative UI Scales/fewer headaches
  8. The way we build Android, iOS and Web apps is

    very similar. They have the same advantages and drawbacks. Using JavaScript is a win, using React is a bigger win.
  9. The hardest part of learning iOS Development 3% Objective­C Syntax,

    97% iOS APIs Brandon Keepers, Ruby at GitHub, 2013
  10. to build on mobile across three platforms, you need three

    different engineers because there are three different sets of tool chains, languages, and API’s Christopher Chedeau on the Core Philosophies that Underlie React, 2016
  11. React Native is more about writing native apps in React

    than it is about writing native apps in JavaScript
  12. 2. USE JSX STYLES As web developers we like our

    CSS We're not talking about web development Will fridges CSS? Does the terminal CSS?
  13. 4. PROFIT Challenge: make a Web, Android, iOS app in

    no time APIs you know, without a speed/performance tradeoff
  14. THAT CHECKLIST AGAIN 1. Abuse high­level components 2. Use JSX

    styles 3. Profit Thanks to the React contributors for making awesome things