Last active
April 20, 2016 20:39
-
-
Save morizotter/72218a3fb5dc7e9795759586590e2023 to your computer and use it in GitHub Desktop.
ReactとReduxを使ったアプリを試すための環境作る ref: http://qiita.com/morizotter/items/87d4a34d32209cbb98b0
This file contains hidden or 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
Show hidden characters
{ | |
"extends": "airbnb", | |
"plugins": [ | |
"react" | |
], | |
"rules": { | |
"arrow-body-style": "off" | |
} | |
} |
This file contains hidden or 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
import React from 'react'; | |
const App = () => ( | |
<div> | |
hello, world | |
</div> | |
); | |
export default App; |
This file contains hidden or 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> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.4/redux.js"></script> | |
<script src="https://fb.me/react-0.14.0.js"></script> | |
<script src="https://fb.me/react-dom-0.14.0.js"></script> | |
</head> | |
<body> | |
<div id='root'></div> | |
</body> | |
</html> |
This file contains hidden or 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
$ npm init | |
$ npm install lite-server concurrently --save-dev |
This file contains hidden or 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
$ npm install --save redux | |
$ npm install --save react-redux | |
$ npm install --save-dev redux-devtools |
This file contains hidden or 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
$ npm install --save redux | |
$ npm install --save react-redux | |
$ npm install --save-dev redux-devtools |
This file contains hidden or 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
"scripts": { | |
"webpack": "webpack -w", | |
"lite": "lite-server --verbose --open dist", | |
"start": "concurrently \"npm run webpack\" \"npm run lite\"" | |
}, |
This file contains hidden or 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
$ npm init | |
$ npm install --save react react-dom |
This file contains hidden or 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
$ npm install eslint --save-dev | |
$ npm install eslint-plugin-jsx-a11y --save-dev | |
$ eslint --init |
This file contains hidden or 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
$ npm install --save-dev babel-core babel-preset-react babel-preset-es2015 | |
$ npm install --save-dev webpack babel-loader url-loader css-loader style-loader file-loader |
This file contains hidden or 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> | |
<meta charset="UTF-8" /> | |
<title>Hello React!</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script type="text/javascript" src="dist/bundle.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
import React from 'react'; | |
import { render } from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { createStore } from 'redux'; | |
import stopwatchApp from './reducers/Stopwatch'; | |
import App from './components/App'; | |
let store = createStore(stopwatchApp); | |
const rootEl = document.getElementById('root'); | |
render( | |
<Provider store={store}> | |
<App /> | |
</Provider>, | |
rootEl | |
); |
This file contains hidden or 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
module.exports = { | |
entry: `${__dirname}/src/Index.js`, | |
output: { | |
path: `${__dirname}/dist`, | |
filename: 'bundle.js', | |
publicPath: '/dist/', | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js[x]?$/, | |
exclude: /node_modules/, | |
loader: 'babel', | |
query: { | |
presets: ['react', 'es2015'], | |
}, | |
}, | |
{ test: /\.css$/, loader: 'style-loader!css-loader' }, | |
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file' }, | |
{ test: /\.(woff|woff2)$/, loader: 'url?prefix=font/&limit=5000' }, | |
{ | |
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url?limit=10000&mimetype=application/octet-stream', | |
}, | |
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml' }, | |
], | |
}, | |
resolve: { | |
extensions: ['', '.js', '.jsx'], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment