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
530
Other Decks in Programming
See All in Programming
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Jakarta EE meets AI
ivargrimstad
0
510
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
250
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.8k
距離関数を極める! / SESSIONS 2024
gam0022
0
280
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Click-free releases & the making of a CLI app
oheyadam
2
110
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
50
7.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Designing for humans not robots
tammielis
250
25k
Happy Clients
brianwarren
98
6.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
For a Future-Friendly Web
brad_frost
175
9.4k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
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 ࣭ΛͲ͏ͧ