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
Riot.js in WPD-Week
Search
Tsutomu Kawamura
April 15, 2016
Programming
19
11k
Riot.js in WPD-Week
Reactがメンドクサイ僕らのためのフロントエンド
「RIOT」
http://peatix.com/event/156859/view
Tsutomu Kawamura
April 15, 2016
Tweet
Share
More Decks by Tsutomu Kawamura
See All by Tsutomu Kawamura
Connect your library to the world
cognitom
0
96
JTF2018
cognitom
5
1.2k
Riot: changing on v3 and its companion tools
cognitom
0
120
LLoT Night - Riot.js
cognitom
1
920
Felt - a simple web server with the power of the future
cognitom
0
300
Riot: all about v2 to v3
cognitom
7
3.7k
Create A Small Studio in A Cafe
cognitom
2
890
Riot and Components
cognitom
4
580
Cooking Automation
cognitom
1
540
Other Decks in Programming
See All in Programming
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
Outline View in SwiftUI
1024jp
1
330
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
200
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
Better Code Design in PHP
afilina
PRO
0
130
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
flutterkaigi_2024.pdf
kyoheig3
0
150
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Amazon Qを使ってIaCを触ろう!
maruto
0
410
Featured
See All Featured
How GitHub (no longer) Works
holman
310
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Agile that works and the tools we love
rasmusluckow
327
21k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
We Have a Design System, Now What?
morganepeng
50
7.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Unsuck your backbone
ammeep
668
57k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Transcript
Tsutomu Kawamura @cognitom Librize LLC / OpenSource Cafe, Shimokitazawa React͕ϝϯυΫαΠΒͷͨΊͷϑϩϯτΤϯυ
cognitom
None
HJUIVCDPNDPHOJUPN
ࠓɺ͢͜ͱ
w 3JPUKTͱ w 3JPUͰίϯϙʔωϯτΛॻ͘ w ίϯϙʔωϯτ)5.-෦ w 3JPUΛ͏গ͠ ͍͞͠ લ
ΊΜͲ͍ ޙ w ࠷ۙͷϑϩϯτΤϯυɺͳͥ ϝϯυΫαΠͷ͔ w Ͳ͏͢Δ
ఆΦʔσΟΤϯε
None
3JPUKTͱ
݄WFS
ۙWFS
࠷γϯϓϧͰɺ͍ܰ 6*ϥΠϒϥϦ
খ͍͜͞ͱɺળ
͚ͬ͜͏ਓؾ
ίΞίϛολʔͷډॴ
Կ͕Ͱ͖Δͷ
3FBDU 1PMZNFS 7VF 3JPU "OHVMBS ʜ 6* 'MVY 3FEVY ΄͔֤छ
͋Γ͗͢ ʜ ϑϨʔϜϫʔΫϧʔλ $44 4BTT -&44 #&. 1PTU$44 ʜ $44 3PMMVQ #SPXTFSJGZ 8FC1BDL 4ZTUFN+4 ʜ .PEVMF#VOEMFS HVMQ OQN NBLF HSVOU ʜ λεΫϥϯφʔ &4 5ZQF4DSJQU 'MPX $P⒎FF4DSJQU &4 ʜ ݴޠ &YQSFTT -PPQCBDL 3FMBZ ,PB ʜ αʔόαΠυ LBSNB SFDUBOHVMBS OJHIUNBSF ʜ ςετɾMJOU FTMJOU BWB $ZDMFKT
3FBDU 1PMZNFS 7VF 3JPU "OHVMBS ʜ 6* 'MVY 3FEVY ΄͔֤छ
͋Γ͗͢ ʜ ϑϨʔϜϫʔΫϧʔλ $44 4BTT -&44 #&. 1PTU$44 ʜ $44 3PMMVQ #SPXTFSJGZ 8FC1BDL 4ZTUFN+4 ʜ .PEVMF#VOEMFS HVMQ OQN NBLF HSVOU ʜ λεΫϥϯφʔ &4 5ZQF4DSJQU 'MPX $P⒎FF4DSJQU &4 ʜ ݴޠ &YQSFTT -PPQCBDL 3FMBZ ,PB ʜ αʔόαΠυ LBSNB SFDUBOHVMBS OJHIUNBSF ʜ ςετɾMJOU FTMJOU BWB $ZDMFKT ٕज़ελοΫͷதͷɺίίɻ
ίϯϙʔωϯτΛ࡞Ε·͢ <div> <img src=“clear.svg” /> <ul> <li>ۭΑ͏: Ε</li> <li>ؾԹ: 10</li>
<li>࣪: 30%</li> </ul> </div> <weather type=“clear” temperature=“10” humidity=“30%” /> Ε 10 30%
3JPUKTͲΜͳਓ͚
ʮઆ໌ॻಡ·ͳ͍ਓʯ͚ )5.-ɾ+4ɾ$44Λɺී௨ʹཧղ͍ͯͯ͠
SJPUKTDPNQMBZ ͬͯΈΑ͏
3JPUKTɺ طଘٕज़ͰʮίϯϙʔωϯτʯΛ ࣮ݱ͢ΔͨΊͷɺ࠷γϯϓϧͳ Ξϓϩʔνɻ
͑ͬɺίϯϙʔωϯτͬͯ ผ໊ʮΧελϜλάʯ ͔͋ͨ৽͍͠)5.-ཁૉΛɺ ࣗͰ͖ͳΑ͏ʹఆٛͰ͖ͯ͠·͏ͳʹ͔ɻ
None
3JPUͰίϯϙʔωϯτΛॻ͘
<weather> </weather> HTML JS CSS ఆٛ͢ΔλάͰғΉ͚ͩ weather.tag
<weather> <img src=“clear.svg” /> <ul> <li>ۭΑ͏: { types[opts.type] }</li> <li>ؾԹ:
{ opts.temperature }</li> <li>࣪: { opts.humidity }</li> </ul> <sctipt> this.types = { clear: ‘Ε’ } </script> <style scoped> :scope { display: block; } </style> </weather> HTML JS CSS
<weather> <img src=“clear.svg” /> <ul> <li>ۭΑ͏: { types[opts.type] }</li> <li>ؾԹ:
{ opts.temperature }</li> <li>࣪: { opts.humidity }</li> </ul> <sctipt> this.types = { clear: ‘Ε’ } </script> <style scoped> :scope { display: block; } </style> </weather> HTML JS CSS ͔͗Γͳ͘ɺ)5.-ͦͷͷ
index.html riot.js weather.tag app.tag ϑΝΠϧߏ ˞ͬͱ୯७ͳέʔε
<html> <body> <weather></weather> <script src=“riot.js”></script> <script src=“weather.tag” type=“tag”></script> <script> riot.mount(‘weather’,
{ type: ‘clear’, temperature: 10, humidity: ’30%’ }) </script> <body> </body> Ϛϯτ ͜͜ʹϚϯτ
<html> <body> <app></app> <script src=“riot.js”></script> <script src=“app.tag” type=“tag”></script> <script src=“weather.tag”
type=“tag”></script> <script> riot.mount(‘app’) </script> <body> </body> ؒϚϯτ <app> <weather type=“clear” temperature=“10” humidity=“30%” /> </app> ΄ͱΜͲɺεΫϦϓτΛॻ͔ͳͯ͘ࡁΉ ͜͜ʹϚϯτ
ίʔμʔͷ୲Ͳ͏ͳΔͷ
ैདྷͷॻ͖ํ ਫฏۀ CSS HTML JS Template Template Template
3JPUͷॻ͖ํ ਨ౷߹ CSS HTML JS Template Template Template CSS JS
CSS JS CSS JS Tag A Tag B Tag C
w ෆඞཁʹόϥ͚͍ͯͨͷ͕ɺͻͱͭʹ w )5.-ɾ+4ɾ$44ͦΕͧΕཧղ͍ͯ͠Δඞཁ͋Γ w #&.Αɺ͞Α͏ͳΒ ൣғʮٕज़ʯͰͳ͘ ʮίϯϙʔωϯτʯʹ
None
ίϯϙʔωϯτ)5.-෦
<nandemo-iindayo /> <div> </div>
)5.-ʹ͓͚Δʮؔʯ <weather type=“clear” temperature=“10” humidity=“30%” /> <div> <img src=“clear.svg” />
<ul> <li>ۭΑ͏: Ε</li> <li>ؾԹ: 10</li> <li>࣪: 30%</li> </ul> </div> Ε 10 30%
ίϯϙʔωϯτ㲈XFCDPNQPOFOUT 8FCඪ४ʹ͢Δಈ͖ 3JPU 3FBDU "OHVMBS 1PMZNFS
ਖ਼ɺ͍ͭʹͳΔ͔͔Βͳ͍
ίϯϙʔωϯτWTςϯϓϨʔτ
ίϯϙʔωϯτ ςϯϓϨʔτ )5.-ͷมຒΊࠐΈ :&4 :&4 ΧελϜλάͱͯ͠ৼΔ͏ :&4 /0 ϏϡʔϩδοΫ ϏϡʔͷϦΞϧλΠϜมߋ
:&4 /0 ϏδωεϩδοΫ /0 /0 ίϯϙʔωϯτWTςϯϓϨʔτ ॻ͍ͪΌμϝ
“Templates separate technologies, not concerns.” ʮςϯϓϨʔτ͕Γ͚͍ͯͨͷɺ ͡Όͳٕͯ͘ज़ͩʯ CZ'BDFCPPLͷதͷਓ
Ϗϡʔ ϏδωεϩδοΫ ϏϡʔϩδοΫ Ϗϡʔ ϏδωεϩδοΫ ϏϡʔϩδοΫ ίϯϙʔωϯτ ςϯϓϨʔτ
ίϯϙʔωϯτWTK2VFSZ
ίϯϙʔωϯτWTK2VFSZ )5.-͕ඳը͞ΕΔ Πϕϯτ͕ى͖Δ )5.-͕ඳը͞ΕΔ K2VFSZͰॻ͖͑Δ Πϕϯτ͕ى͖Δ
ίϯϙʔωϯτ K2VFSZ )5.-ͷѻ͍ એݴత ॻ͍ͨ·Μ· ࠩΛૢ࡞ Ͳ͏ม͑Δ͔ σʔλͷྲྀΕ σʔλˠϏϡʔ جຊతʹ
ͪ͝Όͪ͝Ό ίϯϙʔωϯτWTK2VFSZ
None
3JPUΛ͏গ͠
܁Γฦ͠ͱσʔλ <ul> <li>Apple</li> <li>Orange</li> <li>Banana</li> </ul> <ul> <li each={ fruits
}>{ name }</li> </ul> <script> this.fruits = [ { name: ‘Apple’ }, { name: ‘Orange’ }, { name: ‘Banana’ } ] </script>
Πϕϯτϋϯυϥ <input value={ username } onchange={ change }> <script> this.username
= ‘MEGANE’ this.change = e => { username = e.target.value } </script>
4DPQFE$44 <p>WP-D Week</p> <style scoped> :scope { /* ίϯϙʔωϯτͦͷͷͷελΠϧ */
} p { /* ίϯϙʔωϯτͷpλάͷΈʹ༗ޮ */ } </style>
͋ͱɺυΩϡϝϯτݟͯ
None
࠷ۙͷϑϩϯτΤϯυ ͳͥϝϯυΫαΠͷ͔
ϑϩϯτΤϯυ͕͍͠ +BWB4DSJQU͕͍͠
͠͞⁞ จ๏͕ɺશʹϕπϞϊ
ʮͳʜԿΛݴ͍ͬͯΔͷ͔ ɹΘ͔ΒͶʔͱࢥ͏͕ɺ ɹ͓ΕԿΛ͞Εͨͷ͔Θ͔Βͳ͔ͬͨʯ
map(), reduce(), forEach(), some()… for (of), Object.keys() Promise().then() function* (),
yield, async/await const, let, { foo, bar } import foo from ‘foo’, export default foo ͳʹ͜ͷ֎ࠃޠ
͠͞ ςετͱ͔ɺλεΫͱ͔
λεΫϥϯφʔ ςετϦϯλʔ ͦͷଞʜ
͠͞ OQNͱϞδϡʔϧ
ສ ύοέʔδ
import add from ‘./add’ const x = add(1, 2) export
default function add (a, b) { return a + b } ผϑΝΠϧ͔Β ಡΈࠐΊΔ
͠͞ ϙϦϑΟϧͱίϯύΠϧ όϯυϧ
#BCFM #BCFM #BCFM #BCFM #BCFM &4 &4 &4 &4 $ISPNF
4BGBSJ 'JSFGPY &EHF /PEF ϙϦϑΟϧ ࣮લʹػೳΛઌऔΓ
ίϯύΠϧ
͓͢͢Ί όϯυϥʔɺ͍Ζ͍Ζɻ
None
͠͞ ԿʹΓ্͕ͬͯΔͷ͔ Θ͔ΒͶ͑
൙ཞ͢ΔμΠΞάϥϜɺ ܁Γ͛ΒΕΔۭதઓ
੍࣌ΛखʹೖΕͭͭ͋Δ +BWB4DSJQU ࠓேͷ්ͷձ͔Β
چੈքͷ+BWB4DSJQUɺ ͏Ε͍ͯͩ͘͞ɻ ͏·ͬͨ͘ผͷݴޠͰ͢ɻ ʮͨ͠ͳΈʯͱ͔ʮখखઌʯͰͲ͏ʹ͔ͳΔͷͰͳ͘ͳΓ·ͨ͠ɻ
͋Δ͍ʜ ·ͱͳϓϩάϥϜݴޠͱͯ͠ɺ ΘΕΔΑ͏ʹͳͬͨɻ
None
Ͳ͏͢Δ
બࢶ⁞ มԽΛɺָ͠Ή ڧ͍ͯݴ͑ʮΦΠϥʔͷެࣜʯ͕ ൃݟ͞Ε͔ͨͷΑ͏ͳ໘ന͕͞ɺ ࠓͷ+BWB4DSJQUʹ͋Δ
બࢶ ͦͬͱด͡Δ ṷṷɻखग़͞ͳ͍ɻ ޙ͘Β͍ʹɺ͏ҰݟʹདྷΔΑɻ
બࢶ దͳڑײͰ ϑϩϯτͷɺϏϡʔ͚ͩʹݶఆ͢Δɻ K2VFSZఔͷڑײͰ͢Δɻ
3JPUɺ ʮϑϩϯτ͚ͩΔʯ ͱ͍͏બࢶΛఏڙͯ͘͠ΕΔ ʹϑϧελοΫʹͳΓ͗͢ͳ͍
None
5IBOLZPV ࣭ΛͲ͏ͧ