Dev tools

Examples

官网例子

Real World

http://redux.js.org/docs/introduction/Examples.html#real-world

组件结构图:

实际案例

前后端分离 - https://www.docstub.com/

Redux module concept

Action

遵循Flux Standard Action(FSA)

  • type: Required. A string or Symbol indicating the action type.
  • payload: Optional. Any value or object containing data related to the action.
  • error: Optional. A boolean that, when true, indicates that the payload is an Error object.
  • meta: Optional. Any value or object containing data that isn’t part of the payload.
{
    type: 'CONST',
    meta: {
        // Everything in 'meta' will *only* handled by middleware
    },
    payload: {
        // Payload contains all data for use within a reducer
    },
    error: '' // An optional error parameter
}

使用https://www.npmjs.com/package/redux-actions 可以节省一些代码工作

Term

payload

参照payload是什么

How to chain async actions

https://github.com/reactjs/redux/issues/1676#issuecomment-215413478

See also