Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
VanillaJSでIsomorphicなFluxアプリ作ってみた話
Search
Amagi
February 03, 2016
Programming
6
2.3k
VanillaJSでIsomorphicなFluxアプリ作ってみた話
Kyoto.js #9
Amagi
February 03, 2016
Tweet
Share
More Decks by Amagi
See All by Amagi
Enchant your website with VFX-JS
fand
0
54
How to hack VS Code: evil ways (Japanese)
fand
5
3.5k
READY FOR THE BATTLE? -Introduction to Live Coding-
fand
1
470
GLSL PostEffect in TouchDesigner
fand
2
1.9k
VEDA GLSL Livecoding workshop
fand
2
5.1k
PWA 方法 無料 今すぐ
fand
3
1.5k
Have you ever heard GPUs cry?
fand
2
3.7k
Real World GLSL
fand
0
250
APIs for VJ-ing
fand
1
6.7k
Other Decks in Programming
See All in Programming
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
Jakarta EE meets AI
ivargrimstad
0
240
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
200
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
940
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
900
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
RubyLSPのマルチバイト文字対応
notfounds
0
120
距離関数を極める! / SESSIONS 2024
gam0022
0
290
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
243
12k
Building Applications with DynamoDB
mza
90
6.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Navigating Team Friction
lara
183
14k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
We Have a Design System, Now What?
morganepeng
50
7.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
380
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Building Adaptive Systems
keathley
38
2.3k
Transcript
*TPNPSQIJD Α· @amagitakayosi Kyoto.js #9
@amagitakayosi
ࠓ͢͜ͱ
ΦϨΦϨ'MVYߏங *TPNPSQIJDԽϋϚΓॴ
ΦϨΦϨ 'MVY
https://speakerdeck.com/fand/hurontoendonizhi-xu-woqu-rili-sufang-fa /PEFֶԂࡇͰհ͠·ͨ͠
ͯͳϒϩάͷFlux w &WFOU&NJUUFSϕʔε w ͷ0CTFSWFSύλʔϯ͔Β نʹԠͯ͡εέʔϧͤ͞Δ
https://gist.github.com/fand/cc70b35eb901bd0ccb24 ݱࡏ ͯͳϒϩάͰಈ͍ͯΔίʔυ
EventEmitter͚ͩͰFlux $PNQPOFOU Πϕϯτ ө Action σʔλมߋ %JTQBUDIFS "DUJPO $SFBUPS 4UPSF
։ൃ߹॓ d
߹॓ w ͓ʮ৽ٕज़Λࢼ͢ʯ w ฐνʔϜશһ5ZQF4DSJQUͰ w ීஈ+4ॻ͍ͯͳ͍ਓʂ
߹॓ΞϓϦͷߏ w ΫϥΠΞϯτ w 54 3FBDU ΦϨΦϨ'MVY w αʔόαΠυ w
54 FYQSFTT BTZODόϦόϦ
BTZOD࠷ߴʂʂ
݁Ռ
None
None
͍ͰΖ͏ w 'MVYͷϦϑΝΫλ ࠶ߏ w ͍ͭͰʹ৭ʑ࣮ݧ͠Α͏ w ͯͳϒϩάͷ'MVYʹ ϑΟʔυόοΫ͠Α͏
*TPNPSQIJD *TPNPSQIJD *TPNPSQIJD *TPNPSQIJD
*TPNPSQIJD w αʔόΫϥΠΞϯτͰ ಉ͡ίʔυΛڞ༗͢Δ͜ͱ
https://speakerdeck.com/koichik/isomorphic-survival-guide *TPNPSQIJD ͷղઆ
IsomorphicԽͷϝϦοτ w ॏෳ͢ΔίʔυΛݮΒͤΔ w αʔόαΠυϨϯμϦϯά 443 w ϊϋΛڞ༗͍͢͠
*TPNPSQIJDԽͷϝϦοτ w ॏෳ͢ΔίʔυΛݮΒͤΔ w αʔόαΠυϨϯμϦϯά 443 w ϊϋڞ༗͍͢͠ ʮαʔό͔͠ग़དྷͳ͍ʯ
ʮΫϥΠΞϯτ͔͠৮Εͳ͍ʯ ʹͳΓʹ͍͘ ……ͣ
*TPNPSQIJDԽʹඞཁͳ͜ͱ
SFBDUSPVUFS ؾ߹ JTPͱ͔ ؾ߹
4JOHMFUPO 'SFF
γϯάϧτϯ w ΫϥΠΞϯτPOMZͷ߹ɺ 4UPSF%JTQBUDIFS γϯάϧτϯͰ0, w 'BDFCPPLͷυΩϡϝϯτͰ lBTJOHMFUPONPEFMPGBMPHJDBMEPNBJOz ͬͯݴͬͯΔ
None
ΫϥΠΞϯτonlyͷ߹ w XJOEPXຖʹ'MVYΞϓϦ͕Ұݸ
SSR͢Δ߹ w ϦΫΤετຖʹ'MVYΞϓϦ͕Ұݸ αʔό
ඞཁͳมߋ w ɹɹɹɹɹΊΔ w ΞϓϦͷΤϯτϦʔϙΠϯτͰ OFXͯ͋͛͠Δඞཁ͕͋Δ
γϯάϧτϯͳStoreΛॻ͖͑Δ
C / S݉༻ͷॳظԽUtil࡞ͬͯ͏
ؾ߹Ͱॻ͖͑
3PVUJOH
react-routerΛ͍·͠ΐ͏ w υΩϡϝϯτʹ443ͷํ๏ࡌͬͯΔ w FYQSFTTͷSPVUFS Bɹɹɹɹɹͱ͔ w SFBDUSPVUFS͡Όͳ͍߹ؤுͬͯ
'FUDIJOH
ํ2ͭ w 3FMBZ 'BMDPSࢼ͢ w ૉʹBKBY͢Δ
Relay w 3FBDUίϯϙʔωϯτఆٛʹ ඞཁͳσʔλΛهड़͢Δͱ উखʹϑΣονͯ͘͠ΕΔ lϑϨʔϜϫʔΫz w ίετߴ͗͢Δ
Falcor w /FUqJY w 3FMBZͱࣅͨΑ͏ͳΜ w ίετߴ͗͢
݁ہૉʹajax w ΫϥΠΞϯτ͔Βݺͼ͍ͨ ΫΤϦϝιουશ෦ʹ ΤϯυϙΠϯτΛ༻ҙ͢Δ w Bͨ͠Β DPOUSJCVUPSTશ෦ฦͬͯདྷΔɺ Έ͍ͨͳ
ॳظԽͲ͏͢Δʁ w ॳظԽ࣌ʹHFU ͯ͠Δॴ ॻ͖͑Δඞཁ͕͋Δʁ w SFBDUEPNTFSWFSͩͱ DPNQPOFOU%JE.PVOUݺΕͳ͍ ɹˠॻ͖͑ෆཁ
componentDidMountͷΑ͏͢
)ZESBUJPO
Hydration/Dehydration w ΞϓϦέʔγϣϯͷঢ়ଶΛ ΫϥΠΞϯταʔόؒͰڞ༗͢Δ w 443ͰඞཁʹͳΔ
ϦΫΤετ͕དྷͨΒ αʔό
αʔό্ͰΞϓϦΛॳظԽͯ͠ HTMLʹrender αʔό )5.-
renderࡁΈHTMLʹ σʔλΛຒΊࠐΜͰฦ͢ αʔό )5.-
ΫϥΠΞϯτॳظԽ࣌ʹ ຒΊࠐ·ΕͨσʔλΛϩʔυ )5.-
ΫϥΠΞϯτͰrender্ͯ͠ॻ͖ αʔόͰ SFOEFS͞Εͨ %0. ৽͍͠ %0.
HydrationͲ͏Δͷ w ϑϨʔϜϫʔΫͷػೳΛ͏ w 'MVYJCMF "MU w HPBUTMBDLFSJTP͔ͭ͏ w "MU࡞ऀͷIZESBUJPOϥΠϒϥϦ
w ࠓճ+40/TUSJOHJSZQBSTFͰ
dehydrationͷΑ͏͢
dehydrationͷΑ͏͢
rehydrationͷΑ͏͢
3िؒ΄Ͳઓͬͨ ݁Ռ
None
None
·ͱΊ
͚ͬ͜͏େม w *TPNPSQIJDͳΈ࡞Δͷ ͔͔࣌ؒΔ w Ұ׳ΕͨΒ؆୯͚ͩͲ νʔϜϝϯόʔͱͷϊϋڞ༗Ή͍ͣ
ϑϨʔϜϫʔΫ࠷ߴ w ϑϨʔϜϫʔΫ࡞ऀ ؤு͍ͬͯͯ͢͝ w େͷਓؾϑϨʔϜϫʔΫ *TPNPSQIJDରԠͯ͠Δ w ίʔυಡΉͱ݁ߏటष͔ͬͨΓ͢Δ
͋Γ͕ͱ͏͍͟͝·ͨ͠