Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Riot.js in WPD-Week

Riot.js in WPD-Week

Reactがメンドクサイ僕らのためのフロントエンド
「RIOT」
http://peatix.com/event/156859/view

Tsutomu Kawamura

April 15, 2016
Tweet

More Decks by Tsutomu Kawamura

Other Decks in Programming

Transcript

  1. w 3JPUKTͱ͸ w 3JPUͰίϯϙʔωϯτΛॻ͘ w ίϯϙʔωϯτ)5.-෦඼ w 3JPUΛ΋͏গ͠ ΍͍͞͠ લ൒

    ΊΜͲ͍ ޙ൒ w ࠷ۙͷϑϩϯτΤϯυ͸ɺͳͥ
 ϝϯυΫαΠͷ͔  w Ͳ͏͢Δ
  2. 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
  3. 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 ٕज़ελοΫͷதͷɺίίɻ
  4. ίϯϙʔωϯτΛ࡞Ε·͢ <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%
  5. <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
  6. <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.-ͦͷ΋ͷ
  7. <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> ௚઀Ϛ΢ϯτ ͜͜ʹϚ΢ϯτ
  8. <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> ΄ͱΜͲɺεΫϦϓτΛॻ͔ͳͯ͘ࡁΉ ͜͜ʹϚ΢ϯτ
  9. )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%
  10. ܁Γฦ͠ͱσʔλ <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>
  11. Πϕϯτϋϯυϥ <input value={ username } onchange={ change }> <script> this.username

    = ‘MEGANE’ this.change = e => { username = e.target.value } </script>
  12. 4DPQFE$44 <p>WP-D Week</p> <style scoped> :scope { /* ίϯϙʔωϯτͦͷ΋ͷͷελΠϧ */

    } p { /* ίϯϙʔωϯτ಺ͷpλάͷΈʹ༗ޮ */ } </style>
  13. 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 ͳʹ͜ͷ֎ࠃޠ
  14. import add from ‘./add’ const x = add(1, 2) export

    default function add (a, b) { return a + b } ผϑΝΠϧ͔Β ಡΈࠐΊΔ
  15. #BCFM #BCFM #BCFM #BCFM #BCFM &4 &4 &4 &4 $ISPNF

    4BGBSJ 'JSFGPY &EHF /PEF ϙϦϑΟϧ ࣮૷લʹػೳΛઌऔΓ