isomorphic react + flux at yahoo

22
Isomorphic React+Flux at Yahoo Mr. Friday

Upload: itia-chang

Post on 15-Jul-2015

151 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Isomorphic React + Flux at Yahoo

Isomorphic React+Flux at YahooMr. Friday

Page 2: Isomorphic React + Flux at Yahoo

About me

● MMDays (2007~)● Yahoo TW (2010)● Yahoo US (2011~)

○ Frontpage○ News○ MyYahoo○ ...

Page 3: Isomorphic React + Flux at Yahoo

Agenda

● Isomorphic● React + Flux● Isomorphic Flux● Challenges● Q&A

Page 4: Isomorphic React + Flux at Yahoo

Isomorphic Web

Page 5: Isomorphic React + Flux at Yahoo

Client side Single Page Application

● Benefits: Fast, richer user experiences● Drawbacks:

○ SEO○ Potential double work○ Performance○ Legacy browsers

Page 6: Isomorphic React + Flux at Yahoo

Examples

● No page reload

● Same URL, different experiences after reload

● Any way to reuse the code ?

Page 7: Isomorphic React + Flux at Yahoo
Page 8: Isomorphic React + Flux at Yahoo
Page 9: Isomorphic React + Flux at Yahoo
Page 10: Isomorphic React + Flux at Yahoo

Yahoo had tried it ...

● “First open source isomorphic framework to get any press” - Airbnb

● Lesson learned:○ Server side YUI was too heavy○ Sync Server/Client state and routing was hard○ YUI format is problematic in Node

Page 11: Isomorphic React + Flux at Yahoo

React JS

● Finite state machine

● Re-render everytime

● Virtual DOM to save perf.

Page 12: Isomorphic React + Flux at Yahoo

Flux

● Uni-directional data flow

Page 13: Isomorphic React + Flux at Yahoo

Isomorphic + React + Flux ?

● Plain javascript to run efficiently on both server and client

● State transferring between server/client is easy

● Challenge: Flux is client side only.

Page 14: Isomorphic React + Flux at Yahoo

Server side Flux

Page 16: Isomorphic React + Flux at Yahoo

Challenges - Server-only Libs

● Every code needs to run on server/client. Need a way to handle server side only libraries. ○ Create a service that only runs on server side○ Move them to APIs○ Apache traffic server

Page 17: Isomorphic React + Flux at Yahoo

CSS Challenges

● Dynamic modules brings additonal CSS challenges

● Webpack is not good at including CSS● In tradition, we use CSS combo tool. Now

we either need to reimplement it in react environment, or find something else.

Page 18: Isomorphic React + Flux at Yahoo

CSS: How facebook did it

https://speakerdeck.com/vjeux/react-css-in-js

Page 19: Isomorphic React + Flux at Yahoo

CSS: How Yahoo did it

http://www.smashingmagazine.com/2013/10/21/challenging-css-best-practices-atomic-approach/

Page 20: Isomorphic React + Flux at Yahoo

Holy Grail

Page 21: Isomorphic React + Flux at Yahoo

Q&A

● questions ?

Page 22: Isomorphic React + Flux at Yahoo

Thank you !