Browse Source

Lesson 01

Ryan Florence 9 years ago
commit
f9f476feda
5 changed files with 59 additions and 0 deletions
  1. 7 0
      index.html
  2. 4 0
      index.js
  3. 8 0
      modules/App.js
  4. 25 0
      package.json
  5. 15 0
      webpack.config.js

+ 7 - 0
index.html

@@ -0,0 +1,7 @@
+<!doctype html public="storage">
+<html>
+<meta charset=utf-8/>
+<title>My First React Router App</title>
+<div id=app></div>
+<script src="bundle.js"></script>
+

+ 4 - 0
index.js

@@ -0,0 +1,4 @@
+import React from 'react'
+import { render } from 'react-dom'
+import App from './modules/App'
+render(<App/>, document.getElementById('app'))

+ 8 - 0
modules/App.js

@@ -0,0 +1,8 @@
+import React from 'react'
+
+export default React.createClass({
+  render() {
+    return <div>Hello, React Router!</div>
+  }
+})
+

+ 25 - 0
package.json

@@ -0,0 +1,25 @@
+{
+  "name": "tutorial",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "start": "webpack-dev-server --inline --content-base ."
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "react": "^0.14.7",
+    "react-dom": "^0.14.7",
+    "react-router": "^2.0.0-rc6"
+  },
+  "devDependencies": {
+    "babel-core": "^6.5.1",
+    "babel-loader": "^6.2.2",
+    "babel-preset-es2015": "^6.5.0",
+    "babel-preset-react": "^6.5.0",
+    "http-server": "^0.8.5",
+    "webpack": "^1.12.13",
+    "webpack-dev-server": "^1.14.1"
+  }
+}

+ 15 - 0
webpack.config.js

@@ -0,0 +1,15 @@
+module.exports = {
+  entry: './index.js',
+
+  output: {
+    filename: 'bundle.js',
+    publicPath: ''
+  },
+
+  module: {
+    loaders: [
+      { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?presets[]=es2015&presets[]=react' }
+    ]
+  }
+}
+