var reduceReducers = function () { | |
var reducers = [].slice.call(arguments); | |
return function (previous, current) { | |
return reducers.reduce(function (accu, curr) { | |
return curr(accu, current); | |
}, previous); | |
}; | |
}; |
// INFO: ThunkMiddleware | |
var thunkMiddleware = function (store) { | |
return function (next) { | |
return function (action) { | |
if (typeof action === 'function') { | |
action(store.dispatch, store.getState); | |
} | |
return next(action); | |
}; |
###Redux Egghead Video Notes###
####Introduction:#### Managing state in an application is critical, and is often done haphazardly. Redux provides a state container for JavaScript applications that will help your applications behave consistently.
Redux is an evolution of the ideas presented by Facebook's Flux, avoiding the complexity found in Flux by looking to how applications are built with the Elm language.
####1st principle of Redux:#### Everything that changes in your application including the data and ui options is contained in a single object called the state tree
It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details.
We used to have a helper function called transferPropsTo
. We no longer support this method. Instead you're expected to use a generic object helper to merge props.
render() {
return Component(Object.assign({}, this.props, { more: 'values' }));
In React 0.12, we're making a core change to how React.createClass(...)
and JSX works.
If you're using JSX in the typical way for all (and only) React components, then this transition will be seamless. Otherwise there are some minor breaking changes described below.
The Problem
'use strict'; | |
// simple express server | |
var express = require('express'); | |
var app = express(); | |
var router = express.Router(); | |
app.use(express.static('public')); | |
app.get('/', function(req, res) { | |
res.sendfile('./public/index.html'); |
# load nvm | |
if [[ -f ~/.nvm/nvm.sh ]]; then | |
. ~/.nvm/nvm.sh | |
nvm use v0.10 | |
else | |
echo "You're missing .nvm.sh!" | |
fi | |
export PATH=/usr/local/bin:/usr/local/sbin:$HOME/.rvm/bin:$PATH |