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

Universal React + Flux at Scale!

Universal React + Flux at Scale!

Fluxible's (http://fluxible.io) approach to universal flux and how we deal with the challenges of adopting a new technology at Yahoo's scale.

Video: https://www.youtube.com/watch?v=M3suoQuDvH4

ReactiveConf 2015

Rajiv Tirumalareddy

November 03, 2015
Tweet

Other Decks in Programming

Transcript

  1. View   Flux  on  the  Server   A B ?

    ? Ac#on   Dispatcher   Store   Ac#on  
  2. Ac#on   Dispatcher   Store   View   SERVER  

    HTML   JS/CSS   Dehydrated   Flux  State   (JSON)   Store   View   BROWSER   Universal  Flux   A
  3. Ac#on   Dispatcher   Store   View   SERVER  

    HTML   JS/CSS   Dehydrated   Flux  State   (JSON)   Ac#on   Dispatcher   Store   View   Ac#on   BROWSER   Universal  Flux   A
  4.   if  (device  ===  'smartphone')  {        

     return  <UnreadableFontSize  />;   }  else  if  (...){        //...   }  
  5. Flexible  Layouts   f(x) A   B   C  

    D   A   B   C   D   A   B   C   D  
  6. Reusable  Components   A   A   A   A

      A   A   A   A   A   A   A   A   A   A  
  7. Data  Fetching   Ac#on   Dispatcher   Store   View

      Ac#on   Fetchr   REST  APIs   Ac#on  
  8. Ini#al   Ac#on   IniRal  Data  SoluRon   Ac#on  

    Dispatcher   Store   View   Statically Declared
  9. Ar#cle   Ac#on   IniRal  Data  Example   Navigate Ac#on

      Dispatcher   Store   /ar#cle/8   Ar#cle   View   Fetchr   Ar#cle  API  
  10. CreaRng  Reusable  Bundles   > npm publish <component> Components  

    Stores   AcRon   Creators   Data   Services   CSS  
  11. Asset  Loading   user A   B   C  

    D   E   A   B   C   D   E   BROWSER   SERVER  
  12. Smart  Asset  Loading   user A   B   C

      D   E   A   B   C   D   E   scroll click BROWSER   SERVER  
  13. Minimal  Resources   •  Flexible  layouts   •  Reusable  components

      •  StaRcally  declared  data   •  Smart  bundle  loading   BeIer  User  Experience   •  Faster  page  loads   •  Smaller  k-­‐weight   •  Fewer  cacheable  requests  
  14. Web  Server   TTFB   applicaRon  data   render  

    rouRng   assets   GET   /myapp   end   flush    
  15. TTFB   applicaRon  data   render   Web  Server  

    rouRng   assets   GET   /myapp   end   flush     flush     flush    
  16. Progressive  Rendering   100%   Server   100%   Client

      Preload   Fetch  Data   Render   Example  Use  Case   100%   Server   server   server   CriRcal  modules  above   the  fold   Preload   server   client   Immediately  below  the   fold   100%   Client   client   client   Far-­‐bo>om  or   invoked  by  user  acRon  
  17. The  Bad  Parts   •  Checksum   – One  small  error,

     throws  away  all  markup   – MulRple  render  trees   •  iframes   – Reloaded  on  re-­‐render   – Move  outside  container  and  move  back