感谢题主,让我又更加系统地认识了react。不过建议题主下次问问题前参考stackoverflow,问问题之前先想想自己是否先查过资料。经过一番google结果: connect 一共接受4个参数以及柯里化一个组件参数 connect(mapStateToProps,mapDispatchToProps,null, {withRef: true})(ChildComponent); 使用ref访问被Connect函数包裹的子组件时this.refs._childref.getWrappedInstance() 新版本已经更新为this.refs._childref.wrappedInstance 参考 React中Redux与Ref 联合使用时值得关注的一个问题 How to Use Refs on Connected Components
感谢题主,让我又更加系统地认识了react。不过建议题主下次问问题前参考stackoverflow,问问题之前先想想自己是否先查过资料。
经过一番google结果:
connect 一共接受4个参数以及柯里化一个组件参数
connect(mapStateToProps,mapDispatchToProps,null, {withRef: true})(ChildComponent);
使用ref访问被Connect函数包裹的子组件时
this.refs._childref.getWrappedInstance()
新版本已经更新为
this.refs._childref.wrappedInstance
参考