我已经将用户名、全名和电子邮件地址存储在redux store中。我有一个组件需要电子邮件地址,以便它可以调用API获取用户组信息(使用域 - 即chase@gmail.com成为数据库查询的关键字,使用gmail.com)。该组件连接到store并使用mapStateToProps获取状态信息。
在this.stat = { }中这样做是一种反模式吗?
在this.stat = { }中这样做是一种反模式吗?
this.state = {
group: '',
owner: this.props.user.id,
domain: this.props.user.email.split('@')[1],
errors: {},
}
感谢您提供的所有建议。