Proto code:
LoginComponentWrapper = connect(
state => ({ write: userSelector(state) }),
{ submit }
)(LoginComponent);
and then pass into HOC :
export default Proxy(LoginComponentWrapper, {
name: // here I want access to write props form connect
});
How can I do this ?
May be another form question : How pass into HOC props from connect () ?
You can use mapStateToProps
and allow it to accept extra params:
const mapStateToProps = (state, ownProps) => {
return {
write: state.write,
submit: ownProps.submit
};
};
Usage:
LoginComponentWrapper = connect(mapStateToProps)(props => <LoginComponent {...props} submit={submit}/>);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.