webpack.config.js
{
"name": "learnreact",
"version": "1.0.0",
"description": "React ",
"main": "webpack.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "./node_modules/.bin/webpack-dev-server --content-base src --inline --hot",
"build": "webpack --display-error-details",
"watch": "webpack --progress --colors --watch"
},
"keywords": [
"react"
],
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.11.4",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-html-attrs": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.15.0"
}
}
package.json
{
"name": "learnreact",
"version": "1.0.0",
"description": "React ",
"main": "index.js",
"scripts": {
"dev": "./node_modules/.bin/webpack-dev-server --content-base src --inline --hot",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/cathyleeu/react-learncodeacademy.git"
},
"keywords": [
"react"
],
"author": "cathyleeu",
"license": "ISC",
"bugs": {
"url": "https://github.com/cathyleeu/react-learncodeacademy/issues"
},
"homepage": "https://github.com/cathyleeu/react-learncodeacademy#readme",
"dependencies": {
"babel-core": "^6.11.4",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-html-attrs": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.15.0"
}
}
client.js
import React from 'react';
import ReactDOM from 'react-dom';
class Layout extends React.Component{
render(){
return(
<p>ws!!!ooh</p>
);
}
}
const app=document.getElementById('app');
ReactDOM.render(<Layout/>,app);
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div id='app'></div>
<script src='client.min.js'></script>
</body>
</html>