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

2016-03-11.gotandajs.introduction-of-riot.pdf

 2016-03-11.gotandajs.introduction-of-riot.pdf

mizuki_r

March 11, 2016
Tweet

More Decks by mizuki_r

Other Decks in Technology

Transcript

  1. INTRODUCTION it’s not joke! ▸ Riot is very minimum ▸

    Riot is very simple ▸ Riot is very easy ▸ Riot is very casual 13
  2. <todo> <!-- layout --> <h3>{ opts.title }</h3> <ul> <li each={

    item, i in items }>{ item }</li> </ul> <form onsubmit={ add }> <input> <button>Add #{ items.length + 1 }</button> </form> <!-- logic --> <script> this.items = [] add(e) { var input = e.target[0] this.items.push(input.value) input.value = '' } </script> <todo> 14
  3. WHY RIOT why Riot ▸ easy to learn ▸ easy

    to use ▸ make small, summarize small 18
  4. WHY RIOT easy to learn ▸ lifecycle (mount, update, updated,

    unmount) ▸ update ▸ yield ▸ dom events http://riotjs.com/ja/api/ 19
  5. WHY RIOT easy to use ▸ script in html ▸

    very simple usage <todo> <!-- layout --> <h3>{ opts.title }</h3> <ul> <li each={ item, i in items }>{ item }</li> </ul> <form onsubmit={ add }> <input> <button>Add #{ items.length + 1 }</button> </form> <!-- logic --> <script> this.items = [] add(e) { var input = e.target[0] this.items.push(input.value) input.value = '' } </script> <todo> <body> <!-- place the custom tag anywhere inside the body --> <todo></todo> <!-- include riot.js --> <script src="riot.min.js"></script> <!-- include the tag --> <script src="todo.js" type="riot/tag"></script> <!-- mount the tag --> <script>riot.mount('todo')</script> </body> 20
  6. WHY RIOT make small 1. create html ٩(๑´3ʆ๑)۶ 2. separate

    tags 3. ʮhum… it’s largeʯ(´ɾωɾʆ) 4. separate tags 5. repeat 1 … 4 ٩(๑`^´๑)۶ possible to turn a lot of small cycle!! 21
  7. WHY RIOT sammrize small example of using webpack. view/app/components ᵓᴷᴷ

    ffp ᴹ ᵓᴷᴷ index.tag ᴹ ᵋᴷᴷ style.css ᵓᴷᴷ ffp-body ᴹ ᵓᴷᴷ index.tag ᴹ ᵓᴷᴷ store.js ᴹ ᵋᴷᴷ style.css ᵓᴷᴷ ffp-code-pretty ᴹ ᵓᴷᴷ index.tag ᴹ ᵓᴷᴷ store.js ᴹ ᵋᴷᴷ style.css ᵓᴷᴷ ffp-header ᴹ ᵓᴷᴷ index.tag ᴹ ᵋᴷᴷ style.css ᵓᴷᴷ ffp-input ᴹ ᵓᴷᴷ action-creator.js ᴹ ᵓᴷᴷ index.tag ᴹ ᵋᴷᴷ style.css ᵓᴷᴷ ffp-loading ᴹ ᵓᴷᴷ index.tag ᴹ ᵓᴷᴷ store.js ᴹ ᵋᴷᴷ style.css ᵋᴷᴷ ffp-result ᵓᴷᴷ index.tag ᵓᴷᴷ store.js ᵋᴷᴷ style.css https://github.com/rymizuki/electron- ffp/tree/master/view/app/ components possible to separate into component. 22
  8. USE CASE there is a problem also… ‣ take over

    all of the data on child becomes larger, there is danger of conflict!!! todoList.todos => { todos } todoList.tags.todo => { todos, name, description } todoList.tags.todo.tags.description => { todos, name, description, content } 24
  9. USE CASE use case ‣ try quickly ideas ‣ make

    a small app ‣ when just want to write ‣ in combination with other libraries started small, until the scale of the moderate 25
  10. CONCLUSION Riot is awesome ‣ Riot is very minimum ‣

    Riot is very simple ‣ Riot is very easy ‣ Riot is very casual 27