请你能帮我理解什么是对应React元素的相应JSX语法?如何将具有大量属性的对象作为道具传递给React元素?
const data = {
className: "myEl",
"data-numb": 3,
"data-created": 191017
//following other 20 attributes
}
React.createElement("div",data,"test");
我猜你会不会写在JSX语法此元素以这种方式
<div className="myEl" data-numb=3 data-created=191037 ....the other 20 attributes.... />
那么,什么是通过作为道具的阵营元素,有一个巨大的物体的理想方式属性的数量?
为什么不只是在子组件中传递data = data和access作为this.props.data.className? –
@chandrasugur - 使用浅等于比较(反正在PureComponents上)对状态和道具进行重新渲染的目的将是避免这种情况的一个原因。 – Adam
@Adam很高兴认识这个。谢谢。 –