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
95
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
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
140
推し活としてのrails new/oshikatsu_ha_iizo
sakahukamaki
3
1.7k
JaSST 24 九州:ワークショップ(は除く)実践!マインドマップを活用したソフトウェアテスト+活用事例
satohiroyuki
0
260
色々なIaCツールを実際に触って比較してみる
iriikeita
0
270
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
480
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
230
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.4k
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.4k
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
270
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
230
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
PRO
2
1.7k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
38
7k
Agile that works and the tools we love
rasmusluckow
327
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
GraphQLとの向き合い方2022年版
quramy
43
13k
Navigating Team Friction
lara
183
14k
Building an army of robots
kneath
302
42k
Building Applications with DynamoDB
mza
90
6.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Fireside Chat
paigeccino
32
3k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Adopting Sorbet at Scale
ufuk
73
9k
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 ࣭ΛͲ͏ͧ