npm install webpack -g
npm install --save-dev webpack
npm install babel-preset-react
find . -name foo -type d |
sed -i '' -e '$ d' .gitignore |
http://ezprompt.net/ |
{ | |
"name": "todo", | |
"version": "1.0.0", | |
"description": "foobar", | |
"main": "index.js", | |
"scripts": { | |
// npm run server requires webpack-dev-server. | |
// not suer about content base could be something else | |
"server": "./node_modules/.bin/webpack-dev-server --inline --hot --content-base src", | |
"test": "echo \"Error: no test specified\" && exit 1" |
// very similar to *args in Python | |
// when defining a function | |
let sum = function(...args) { | |
return args.reduce((prev, curr) => prev + curr); | |
}; | |
console.log( sum(1, 2, 3) ); |
// simple in-out | |
module.exports = { | |
entry: `${__dirname}/src/app.js`, | |
output: { | |
path: `${__dirname}/dist`, | |
filename: 'bundle.js' | |
}, | |
} | |
// loaders/transpilers/webpack-dev-server |
touch foo/bar/{marcus,nathan}.rb | |
ls foo/bar/ | |
# . | |
# .. | |
# marcus.rb | |
# nathan.rb | |
rm foo/bar/{marcus,nathan}.rb | |
ls foo/bar | |
# . | |
# .. |
http://survivejs.com/react/getting-started/understanding-react-components/
React components can be in three phases during their lifecycles:
methods include:
componentWillMount()
This gets triggered once before any rendering happens. ie could use and ajax
document.createElement("div").setAttribute("style", "color:blue;") |