我想使用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?

最佳答案

https://github.com/reduxjs/react-redux/releases/tag/v6.0.0

关于javascript - react-redux-v6 : withRef is removed.要访问包装的实例,请在连接的组件上使用ref,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53819335/

10-13 03:37