Skip to content

Instantly share code, notes, and snippets.

@luchoching
Created May 7, 2015 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luchoching/a865e5fc29503859f7a7 to your computer and use it in GitHub Desktop.
Save luchoching/a865e5fc29503859f7a7 to your computer and use it in GitHub Desktop.
ES6 + react + webpack
import React from 'react';
import Hello from './components/Hello.jsx';
React.render(<Hello />, document.getElementById('app'));
.
├── css
├── index.html
├── js
├── node_modules
├── package.json
├── README.md
└── webpack.config.js
import React from 'react';
let Hello = React.createClass({
render(){
return(
<div>
<h1>Hello 贊啦!!</h1>
</div>
);
}
});
export default Hello;
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>New React App</title>
</head>
<body>
<section id="app"></section>
<script type="text/javascript" src="bundle.js"></script>
</body>
</html>
{
"name": "ES6React",
"version": "0.0.0",
"description": "ES6 + react + webpack",
"scripts": {
"start": "webpack-dev-server --hot --progress --colors",
"build": "webpack --progress --colors"
},
"devDependencies": {
"babel-core": "^5.2.16",
"babel-loader": "^5.0.0",
"react": "^0.13.2",
"react-hot-loader": "^1.2.7",
"webpack": "^1.8.11",
"webpack-dev-server": "^1.8.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment