0
我怎么可以创建基于道具或初始状态值传递多个元素传递的值作出反应。如何创建多个标签的基础上,通过道具
constructor(props, context) {
this.state = {
numberOfElements: this.props.numberOfElements || 6
}
render() {
return (
<div>
{/*Six elements if not passed through props*/}
span
span
...
span
</div>
)
}
是否有React.method可用于此目的?
@VonAxt如果这个答案或其他任何一个解决您的问题,请标记为接受 –