react-redux
react-redux是react和redux的绑定库,
connect([mapStateToProps],[mapDispatchToProps],[mergeProps],[options]) Provider继承Component class Provider extends Component {
getChildContext() {
return { store: this.store }
}
constructor(props,context) {
super(props,context)
this.store = props.store
}
render() {
const { children } = this.props
return Children.only(children)
}
}
Provider.propTypes = {
store: storeShape.isRequired,children: PropTypes.element.isRequired
}//store,children
Provider.childContextTypes = {
store: storeShape.isRequired
}//store
connect:返回一个WrappedComponent对象,做四件事
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |