import React from 'react';
import PropTypes from 'prop-types';

class Provider extends React.Component {
static childContextTypes = {
store:PropsTypes.object
}
constructor(props,context){
super(props,context)
this.store=props.store
}
getChildContext(){
return {store:this.store}
}
render(){
return this.props.children
}
}

Provider的作用是把store放在context里面,所有的子元素可以直接提取到store

最新文章

  1. 一道js面试题
  2. Windows Squid 安装配置
  3. C/C++中的getline函数总结:
  4. spring支持的websocket
  5. c语言知识(1)
  6. awr报告
  7. HTML5简介、视频
  8. ios app唤起页面跳转
  9. Python学习-使用matplotlib画动态多图
  10. android项目红色感叹号
  11. bzoj 2004: [Hnoi2010]Bus 公交线路
  12. 读spring源码(三)-ClassPathXmlApplicationContext-getBean
  13. class中限定绑定属性__slots__方法
  14. appium定位之xpath定位
  15. 【CSS基础】实现 div 里的内容垂直水平居中
  16. 利用Nuget打包添加tools下intsall.ps1【powershell脚本】修改.csproj文件
  17. MVC 学习(一)Linq to Entities 简单Demo
  18. poj 3013 最短路变形
  19. Hibernate 查询sql结果行数的几种方法
  20. 推荐一款基于Angular实现的企业级中后台前端/设计解决方案脚手架

热门文章

  1. 解决git status中文路径乱码
  2. sed使用---转义字符
  3. pugixml的使用
  4. 使用Fiddler为满足某些特定格式的网络请求返回mock响应
  5. 51nod 1490: 多重游戏(树上博弈)
  6. flask 根路由在蓝图中
  7. wangeditor 粘贴word内容带样式
  8. react教程 — redux
  9. java配置和tomcat安装
  10. 渗透测试工具sqlmap基础教程