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

React.jsの紹介

 React.jsの紹介

* React.js いいね!
* もっとJavaScriptの事を知ろうよ

裕美 吉田

June 13, 2016
Tweet

More Decks by 裕美 吉田

Other Decks in Technology

Transcript

  1. ຊ೔಺༰ ࣗݾ঺հ +BWB4DSJQUͷྺ࢙ &4 &4  41" 41"༻ϥΠϒϥϦʔɾ ϑϨʔϜϫʔΫ 3FBDUKT

    3FBDUKTσϞ 3FEVY Ϟμϯ+4։ൃ؀ڥ 8FCҎ֎Ͱͷ +BWB4DSJQUར༻ ͓஌Βͤɾ·ͱΊ 2" 2
  2. &:0⒏DF։ൃ 8FC 9 w ΞδΞϦʔάΞΠεϗοέʔ wIUUQXXXBMIPDLZKQ wνʔϜɾબखͷ੒੷ूܭ w1FSMಠࣗϑϨʔϜϫʔΫ wΞϩϋύʔΫ wIUUQQBSLBMPIB

    TUSFFUDPN w4/4 w+BWB4FBTBS wωοτγϣοϓ wIUUQXXXCPSPDPKQ w3BJMTK2VFSZ w34QFD$VDVNCFS w๖͑τʔΫ ੠༏ͱ4LZQF Ͱ͓࿩  wIUUQXXXNPFUBMLKQ w੠༏ͱͷձ࿩༧໿༧໿ w3BJMTK2VFSZ w34QFD3FRVFTU
  3. 17 04 GSBNFXPSL "QQMJDBUJPO %BUB#BTF MBOHVBHF +BWB $ 3VCZ 1)1

    )5.- $44 +BWB4DSJQU (SBQIJDT σβΠφʔ ϓϩάϥϚʔ ϑϩϯτΤϯυΤϯδχΞ 8FCΞϓϦ։ൃͷੈքɾࠓ /PEFKT K2VFSZ "OHVMB 3FBDU
  4. +BWB4DSJQUͷྺ࢙ 20 41" "KBY ҉ࠇظ 1995 2005 2010 2015 JavaScript஀ੜ

    ECMAScript1 Gmail , Google Maps Google V8 CoffeeScript Node.js TypeScript ECMAScript6 Prototype.js jQuery Backbone.js Ember.js AngularJS React.js
  5. 41" 4JOHMF1BHF"QQMJDBUJPO ɿ6*ΛΫϥΠ ΞϯταΠυͷ+BWB4DSJQUͰશͯߦ͏ελΠϧ ͷ8FCΞϓϦ 3FBDU/BUJWFɿ+4 3FBDUKT Λ࢖ͬͨεϚϑΥ ΞϓϦ։ൃ؀ڥ &MFDUSPOɿ/PEFKT

    $ISPOJVN $ISPNFͷΤ ϯδϯ Λ࢖͍ϚϧνϓϥοτϑΥʔϜͳ(6*πʔ ϧΛ࡞ΕΔϕʔε 26 +4ͷྺ࢙ɿݱࡏ େൃల 
  6. 30 &4 &4 var PI = 3.141592 function square(x) {

    return x * x; } function tax(n, rate) { if (rate == undefined) rate = 0.08; return Math.floor(n * rate); } const PI = 3.141592 square = (x) => x * x tax = (n, rate = 0.08) => Math.floor(n * rate) &4 &4
  7. 31 &4 &4 Jyanken = (function() { function Jyanken(hand) {

    this.hand = hand; } jyanken.prototype.poi = function() { return this.hand = Math.floor(Math.random() * 3); }; jyanken.prototype.judge = function(your) { if (this.hand === your.hand) { return "Ҿ͖෼͚"; } else if ( ..লུ.. ) { return "উͪ"; } else { return "ෛ͚"; } }; return Jyanken; })(); class Jyanken { constructor(hand) { this.hand = hand } poi() { this.hand = Math.floor(Math.random() * 3) } judge(your) { if (this.hand === your.hand) { return "Ҿ͖෼͚" } else if ( ..লུ.. ) { return "উͪ" } else { return "ෛ͚" } } } &4 &4
  8. "KBYෳࡶ 36 controller model view HTML (css, image) request HTML

    Server Browser JS request HTML state, data
  9. 41" 37 controller model request Server Browser JS controller model

    view HTML css, image JSON iOS / Android request JSON $MJFOUTJEF.7$ͱݺ͹ΕΔࣄ΋͋Δ
  10. σϞͷ։ൃ؀ڥͷߏஙखॱ 88 $ mkdir frontend $ cd frontend $ mkdir

    -p src/js src/css $ brew install node $ npm init -y $ npm install --save react react-dom $ npm install --save isomorphic-fetch $ npm install --save material-design-lite $ npm install —-save-dev babel-loader babel-preset-es2015 babel-preset-react $ npm install —-save-dev eslint eslint-loader eslint-plugin-react babel $ npm install —-save-dev css-loader style-loader $ npm install -g webpack
  11. σϞͷ։ൃ؀ڥͷઃఆ 89 module.exports = { entry: { "app": "./src/js/index.js", },

    output: { path: '../public/js', filename: "[name].js" }, module: { preLoaders: [{ test: /\.js$/, exclude: /node_modules/, loader: "eslint-loader" }], loaders: [{ test: /\.css$/, loader: "style!css" }, { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }] }, resolve: { extensions: ['', '.js', '.css'] }, eslint: { configFile: './.eslintrc' } }; XFCQBDLDPOpHKT