Skip to content

Instantly share code, notes, and snippets.

@Sebastian1011
Last active December 29, 2016 06:50
Show Gist options
  • Save Sebastian1011/fcdb45b4785910f251af203b8ef06c08 to your computer and use it in GitHub Desktop.
Save Sebastian1011/fcdb45b4785910f251af203b8ef06c08 to your computer and use it in GitHub Desktop.
数据通信
1、上下级之间通过回掉函数进行通信
2、同级之间通过上级进行通信和更新数据
3、以全局事件的形式进行通信
4、flux redux等数据导流的方式
Redux
主要分为3个部分:Action, Reducer , Store
主要功能
1、action: 用来传递操作state的信息,以js plain object 形式。其中type 属性是必须的其他字段自定义
type 用来定义处理state数据的方式;
{
type : 'add_repo',
name : 'repo_name'
}
也可以通过函数来创建action
function addFilm(name) {
return { type: 'ADD_FILM', name: name };
}
2、 reducer :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment