redux-0.6.0.zip
资源文件列表:

redux-0.6.0/
redux-0.6.0/.babelrc 43B
redux-0.6.0/.eslintrc 349B
redux-0.6.0/.gitignore 40B
redux-0.6.0/.jshintrc 75B
redux-0.6.0/.npmignore 13B
redux-0.6.0/LICENSE 1.05KB
redux-0.6.0/README.md 6.48KB
redux-0.6.0/TODO 148B
redux-0.6.0/examples/
redux-0.6.0/examples/counter/
redux-0.6.0/examples/counter/App.js 530B
redux-0.6.0/examples/counter/Counter.js 517B
redux-0.6.0/examples/counter/actions/
redux-0.6.0/examples/counter/actions/CounterActions.js 542B
redux-0.6.0/examples/counter/constants/
redux-0.6.0/examples/counter/constants/ActionTypes.js 108B
redux-0.6.0/examples/counter/stores/
redux-0.6.0/examples/counter/stores/counterStore.js 308B
redux-0.6.0/examples/counter/stores/index.js 43B
redux-0.6.0/examples/index.html 157B
redux-0.6.0/examples/index.js 206B
redux-0.6.0/examples/server.js 420B
redux-0.6.0/examples/todo/
redux-0.6.0/examples/todo/App.js 303B
redux-0.6.0/examples/todo/Body.js 424B
redux-0.6.0/examples/todo/Header.js 443B
redux-0.6.0/examples/todo/actions/
redux-0.6.0/examples/todo/actions/index.js 133B
redux-0.6.0/examples/todo/constants/
redux-0.6.0/examples/todo/constants/ActionTypes.js 35B
redux-0.6.0/examples/todo/stores/
redux-0.6.0/examples/todo/stores/index.js 321B
redux-0.6.0/examples/webpack.config.js 742B
redux-0.6.0/package.json 1.31KB
redux-0.6.0/scripts/
redux-0.6.0/scripts/build 65B
redux-0.6.0/src/
redux-0.6.0/src/Container.js 2.58KB
redux-0.6.0/src/Root.js 643B
redux-0.6.0/src/addons/
redux-0.6.0/src/addons/container.js 707B
redux-0.6.0/src/addons/getDisplayName.js 119B
redux-0.6.0/src/addons/root.js 448B
redux-0.6.0/src/createDispatcher.js 3.4KB
redux-0.6.0/src/index.js 207B
资源介绍:
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
Clicked: {counter} times
); } } ``` #### Smart Components ```js // The smart component may inject actions // and observe stores usingClicked: {this.props.counter} times {' '} {' '}
); } } ``` #### The root component ```js import React from 'react'; import { root } from 'redux'; import * as stores from './stores/index'; // Let it know about all the stores @root(stores) export default class App { /* ... */ } ``` ## FAQ ### How does hot reloading work? * http://webpack.github.io/docs/hot-module-replacement.html * http://gaearon.github.io/react-hot-loader/ * Literally that's it. Redux is fully driven by component props, so it works on top of React Hot Loader. ### Can I use this in production? I wouldn't. Many use cases are not be considered yet. If you find some use cases this lib can't handle yet, please file an issue. ### But there are switch statements! `(state, action) => state` is as simple as a Store can get. You are free to implement your own `createStore`: ```js export default function createStore(initialState, handlers) { return (state = initialState, action) => handlers[action.type] ? handlers[action.type](state, action) : state; } ``` and use it for your Stores: ```js export default createStore(0, { [INCREMENT_COUNTER]: x => x + 1, [DECREMENT_COUNTER]: x => x - 1 }); ``` It's all just functions. Fancy stuff like generating stores from handler maps, or generating action creator constants, should be in userland. Redux has no opinion on how you do this in your project. ### What about `waitFor`? I wrote a lot of vanilla Flux code, and my only use case for it was avoiding emitting a change before a related Store consumes the action. In Redux this doesn't matter because the change is only emitted after *all* Stores have consumed the action. If several of your Stores want to read data from each other and depend on each other, it's a sign they should've been a single Store instead. [See this discussion on how `waitFor` can be replaced by the composition of stateless Stores.](https://gist.github.com/gaearon/d77ca812015c0356654f)