在 ReactJS 中,如何映射进入 redux 状态的对象项
In ReactJS, how to map object items coming in redux state
在 ReactJS 中,如何映射进入 redux 状态的对象项?
const mapStateToProps = (state) => {
console.log("state.donorReducer.donor" ,state.donorReducer.donor)
return {
donorReducer: state.donorReducer,
donorslist: state.donorReducer.donor,
}
}
如何映射捐赠者列表项目?
我试过了,
{this.props.donorReducer.donor.map((m, i) => {
return(
<div>
<Paper style={style} zDepth={5} >
>Blood: {m.bloodgroup}<br />
>Mobile: {m.mobile}<br />
>Name: {m.fullname}<br />
>Age: {m.age}<br />
>Address: {m.address}<br />
</Paper>
</div>
)
})
}
您可以简单地映射列表并删除项目前的 >
符号
{this.props.donorslist && this.props.donorslist.map((m, i) => {
return(
<div>
<Paper style={style} zDepth={5} >
Blood: {m.bloodgroup}<br />
Mobile: {m.mobile}<br />
Name: {m.fullname}<br />
Age: {m.age}<br />
Address: {m.address}<br />
</Paper>
</div>
)
})
}
在 ReactJS 中,如何映射进入 redux 状态的对象项?
const mapStateToProps = (state) => {
console.log("state.donorReducer.donor" ,state.donorReducer.donor)
return {
donorReducer: state.donorReducer,
donorslist: state.donorReducer.donor,
}
}
如何映射捐赠者列表项目? 我试过了,
{this.props.donorReducer.donor.map((m, i) => {
return(
<div>
<Paper style={style} zDepth={5} >
>Blood: {m.bloodgroup}<br />
>Mobile: {m.mobile}<br />
>Name: {m.fullname}<br />
>Age: {m.age}<br />
>Address: {m.address}<br />
</Paper>
</div>
)
})
}
您可以简单地映射列表并删除项目前的 >
符号
{this.props.donorslist && this.props.donorslist.map((m, i) => {
return(
<div>
<Paper style={style} zDepth={5} >
Blood: {m.bloodgroup}<br />
Mobile: {m.mobile}<br />
Name: {m.fullname}<br />
Age: {m.age}<br />
Address: {m.address}<br />
</Paper>
</div>
)
})
}