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
Game Widget Library using React
Search
Yosuke Furukawa
PRO
March 01, 2016
Programming
0
1.5k
Game Widget Library using React
React meetup 第三回の発表資料です
Yosuke Furukawa
PRO
March 01, 2016
Tweet
Share
More Decks by Yosuke Furukawa
See All by Yosuke Furukawa
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
0
170
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
150
Removing Corepack
yosuke_furukawa
PRO
9
1.3k
JavaScript Runtime とはなにか
yosuke_furukawa
PRO
15
2.5k
Strip Types と Storage
yosuke_furukawa
PRO
4
340
Module Harmony について
yosuke_furukawa
PRO
3
1.5k
LTのやり方
yosuke_furukawa
PRO
16
2.2k
AppRouter Panel Talk
yosuke_furukawa
PRO
3
700
Node.js v22 で変わること
yosuke_furukawa
PRO
13
5.3k
Other Decks in Programming
See All in Programming
Realtime API 入門
riofujimon
0
150
Jakarta EE meets AI
ivargrimstad
0
730
CSC509 Lecture 12
javiergs
PRO
0
160
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
260
Missing parts when designing and implementing Android UI
ericksli
0
200
flutterkaigi_2024.pdf
kyoheig3
0
170
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
120
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
650
受け取る人から提供する人になるということ
little_rubyist
0
250
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
C++でシェーダを書く
fadis
6
4.1k
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Building an army of robots
kneath
302
43k
Teambox: Starting and Learning
jrom
133
8.8k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Happy Clients
brianwarren
98
6.7k
Music & Morning Musume
bryan
46
6.2k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Adopting Sorbet at Scale
ufuk
73
9.1k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Visualization
eitanlees
145
15k
Designing Experiences People Love
moore
138
23k
Transcript
Game Widget Library using React @yosuke_furukawa
Twitter: @yosuke_furukawa Github: yosuke-furukawa
New Logo
New Node.js Logo is here
Recent works in my company • front-end / server-side engineer
• creating apps using Electron • creating widget library using React
Recent works in my company • front-end / server-side engineer
• creating apps using Electron • creating widget library using React
Demo note: please do not share in SNS….
Our stack • Babel • React • Facebook / flux
• css-modules (post-css) • webpack
Our stack • Babel • React • Facebook / flux
• css-modules (post-css) • webpack
tackling CSS in React
ͳΔ͘1ͭͷJSϑΝΠϧͰ ͔݁ͤͨͬͨ͞ɺJS, CSS͕ ෳʹ͔ΕΔΑ͏ͳঢ়گΛ ආ͚͔ͨͬͨɻ
ήʔϜͷதͰಡΈࠐ·ΕΔͷ Ͱɺcss ͷclassNameڝ߹Λ ͔͗ͨͬͨɻ
We try to choose • CSS in React (using style
attribute) • Radium • css-modules
We try to choose • CSS in React => media
query pseudo attribute ɺ͍͍ͨػೳ͕͑ͳ͔ͬͨɻ • Radium => media query ͳͲରԠ͍ͯ͠Δͷͷɺ Ұ෦ͷpseudo ଐੑͱ͔͕͑ͳ͍ɺยखམͪͩͬͨ • css-modules => CSSͷػೳ͕ී௨ʹ͑ͨɻclass໊ ͷڝ߹શʹ͛ͳ͍͕ɺ͋Δఔ͛Δɻ
css-modules :local(.localClass) { color: green; } :local(.subClass) { color: red;
} :global(.globalClass) { color: blue; } ._23_aKvs-b8bW2Vg3fwHozO { color: green; } ._13LGdX8RMStbBE9w-t0gZ1 { color: red; } .globalClass { color: blue; } http://morishitter.hatenablog.com/entry/2015/09/28/103334
ϑΝο࠷ߴΜ͚ɺ શ෦ΫϦΞͩʂʂ
ൃੜ…
widget library ඞͣήʔϜͷ ϖʔδΑΓઌʹग़ͯͳ͍ͱ͍͚ ͳ͍ͷͰɺ ϨϯμϦϯά্ඞਢͷϨΠΞτ ʹͳΔɻ
scriptΛಡΈࠐΉҐஔ͕ॏཁʹ ͳΔ <script src=“widget.js” /> ͜ΕΛͲ͜ͰಡΈࠐΉ͖͔ <html> <head> <!— ͜͜ͰಡΈࠐΉ?
—> <link rel=“stylesheet” href=“hoge.css”> <!— ͜͜ͰಡΈࠐΉ? —> </head> <body> <!— ͦΕͱɺ͜͜ͰಡΈࠐΉ? —> </body> </html>
ຊདྷ JS ϨΠΞτͱແ ؔͳ͜ͱ͕ଟ͍ͷͰ body ด͡λάͷ্Ͱఆٛ͢Δ͜ͱ ͕ଟ͍͕ɺ͜ͷ߹ css ͱ ಉ༷ͷҐஔʹඞཁʹͳΔ
ϥΠϒϥϦϨΠϠ͚ͩ͡Όղ ܾͰ͖ͳ͍ͷͰɺ͍ํͷυ Ωϡϝϯτʹ໌هɻɻɻ
ࠓେ͖ͳى͖ͯͳ͍ (∩´∀ʆ)∩ƂŖŘ
ͨͩ͠ • ͲΜͳΞϓϦέʔγϣϯ͜ͷΓํ͕ྑ͍ͱࢥΘͳ͍ɻ • JSͱCSSΛҰॹʹͨ͜͠ͱͰى͖Δଟ͍ɻ • cache ͕ޮ͔ͳ͍ͱ͔ • http2
࣌ʹͳͬͨΒͦͦฒྻͰऔͬͯ͜ΕΔͷʹͦͷྑ͞Λ ফͯ͠Δͱ͔ • ࠓճͷΑ͏ͳέʔεׂ͕ͱಛघͳͷͰͳ͍͔ɻ • ΈΜͳී௨ʹCSSΛॻ͖·͠ΐ͏ɻ
Our stack • Babel • React • Facebook / flux
• css-modules (post-css) • webpack
·͊ͬͺΓ ES2015 Θͳ ͍खͳ͍
2015ͳͷʹ·ͩ class Θ ͳ͍ͱ͔ɺtemplate string literals Θͳ͍ͱ͔ϓϥΠυ ͕ڐ͞ͳ͔ͬͨɻ
͋Μ·Γେͨ͠ى͖ͳ͔ͬ ͨ • Babel v6 Ͱੌ·͍͡σάϨ͕Ұճى͖ͯQA ͷਓୡશମͷख͕ࢭ·ͬͨɻɹ • ES2015 શવͷνʔϜʹਁಁͯ͠ͳ͍
͋Μ·Γେͨ͠ى͖ͳ͔ͬ ͨ • Babel v6 Ͱੌ·͍͡σάϨ͕Ұճى͖ͯQA ͷਓୡશମͷख͕ࢭ·ͬͨ(ͷͰɺv5ʹ͠ ͨɻ) • ES2015
શવͷνʔϜʹਁಁͯ͠ͳ͍
͜Ε·Ͱॻ͍ͯͨͷ͘͢͝ basic ͳ JavaScript prototype? ԿͦΕͳਓୡ
ٻΊΒΕΔڭҭ…
None
tower-of-babel νϡʔτϦΞϧΛ࡞ͬͯ ΈΜͳʹΒͤͨ
ͱΓ͋͑ͣॻ͚ΔΑ͏ʹ ͳͬͨ
ͨͩ͠ɻɻɻ
ES5 ͷڭҭ͕ͦͦ͞Εͯ ͳ͍ɻ
Array methodsΒͳ͗͢͞ Function.bindͱʁ
tower-of-es5 ͷػӡ…
ES2015 ͔࣌ͩΒͦ͜ɺ ES5ͪΌΜͱ֮͑ͯѹత
·ͱΊ
React / babel / post-css / flux Ͱ widget ϥΠϒϥϦΛ࡞ͬͯΈͨ
• ͍ΖΜͳήʔϜͰ༡Ϳ࣌ʹReact ͰϥΠϒϥϦ ͕ಈ͕࣌͘དྷΔ͔ • CSS in JS ࠓ css-modules͕ྑ͍ɺͨͩ͠༻ ๏༻ྔʹؾΛ͚ͭͯɻ • ES2015Λָ͠ΉͳΒɺES5͍ͭͰʹ͑Α͏
Thank you for listening