【发布时间】:2019-05-18 01:30:16
【问题描述】:
我想使用ref从连接组件调用函数,所以我之前在连接组件中使用了withRef: true:
export default connect(
mapStateToProps, mapDispatchToProps, null, {withRef: true}
)(InviteReceiverForm)
在演示组件中:
<ExampleComponent
ref={ cmp => { if(cmp) { this.individualSenderFormRef = cmp.getWrappedInstance() }} />
但是在我更新到react-redux v6之后,我得到了这个错误:
withRef is removed. To access the wrapped instance, use a ref on the connected component
如何在react-redux v6 中使用 ref?
【问题讨论】:
标签: javascript reactjs redux react-redux