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

Tips of server-side rendering with
 react + redux

Tips of server-side rendering with
 react + redux

at we're JavaScripter 24th(2018/9/21)

https://wajs.connpass.com/event/100257/

Hiroki Kumamoto

September 22, 2018
Tweet

More Decks by Hiroki Kumamoto

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ • Hiroki Kumamoto • twitter, github: @kumabook • Software

    engineer at Spincoaster, Inc • https://typica.mu • iOS/swift, JavaScript, WebExtensions, rails
  2. ΫϥΠΞϯταΠυϨϯμϦϯά Api server Html server 
 
 
 
 Browser

    Ajax ௨৴ 1. HTMLऔಘ 2. ϧʔςΟϯά͔Β
 ॳظը໘දࣔ 3. API͔Βσʔλऔಘ 4. ॳظը໘ߋ৽
  3. αʔόαΠυϨϯμϦϯάͷ৔߹ Api server server side js expressͳͲ ͷnode੡http server 


    
 
 
 Browser αʔόؒ௨৴ Ajax ௨৴ 1. ϧʔςΟϯά͔Βը໘ܾఆ 2. API ͔Βσʔλऔಘ 3. HTMLੜ੒
  4. ۩ମతͳ࣮૷ • redux-saga • router sagaΛ࣮૷ • urlΛҾ਺ʹͱͬͯɺͦΕʹԠͨ͡initial async taskΛ࣮ߦ

    • ΫϥΠΞϯταΠυ • react-routerͷLOCATION_CHANGE action • αʔόαΠυ • HttpRequestͷurlΛ࢖࣮ͬͯߦ
  5. Tip2: ଟݴޠରԠ • ଟݴޠରԠ • i18next • ΫϥΠΞϯτ: querystring, navigator,

    cookie … • αʔό: Accept-Languageͱ͔ͳͲʹԠͯ͡੾ Γସ͑Δ