Created
March 24, 2016 15:11
-
-
Save bodokaiser/8482e0932fe242967c8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* save under ./app/index.js */ | |
import React, {Component} from 'react' | |
import {render} from 'react-dom' | |
import {Link, Router, Route, browserHistory} from 'react-router' | |
class Home extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>Home</h1> | |
</div> | |
) | |
} | |
} | |
class About extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>About</h1> | |
</div> | |
) | |
} | |
} | |
class Contact extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>Contact</h1> | |
</div> | |
) | |
} | |
} | |
render( | |
<section> | |
<Link to="/">Home</Link> | |
<Link to="/about">About</Link> | |
<Link to="/contact">Contact</Link> | |
<Router history={browserHistory}> | |
<Route path="/" component={Home} /> | |
<Route path="/about" component={About} /> | |
<Route path="/contact" component={Contact} /> | |
</Router>, | |
</section>, | |
document.querySelector('main') | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Physics</title> | |
<link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css"> | |
</head> | |
<body> | |
<main></main> | |
<script src="/build.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "physics", | |
"license": "MIT", | |
"version": "0.0.0", | |
"repository": "bodokaiser/physics", | |
"description": "WebGL physics simulations", | |
"scripts": { | |
"start": "webpack-dev-server -d --history-api-fallback --inline --hot --port 3000" | |
}, | |
"dependencies": { | |
"react": "^0.14.7", | |
"react-dom": "^0.14.7", | |
"react-router": "^2.0.0", | |
"babylonjs": "^2.3.0", | |
"babel-core": "^6.7.4", | |
"babel-loader": "^6.2.4", | |
"babel-preset-react": "^6.5.0", | |
"babel-preset-es2015": "^6.6.0", | |
"webpack": "^1.12.14", | |
"webpack-dev-server": "^1.14.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack') | |
module.exports = { | |
entry: './app/index.js', | |
output: { | |
filename: 'build.js' | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loaders: [ | |
'babel?presets[]=react,presets[]=es2015' | |
] | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment