class Mycomponent extends React.Componet {
render() {
const {name, age } = this.props
return (
<ul>
<li>姓名:{name}</li>
<li>年龄:{ age } </li>
</ul>
)
}
}
ReactDom.render(<Mycomponent name="张三" age="18" />, document.getElementById('test'))
// 或者
const p = { name; '张三', age: 18}
ReactDom.render(<Mycomponent { p } />,document.getElementById('test'))
// 重新复制一个对象
let p = {name: '55', age: "12"}
let p2 = {...p}
标签:const,name,render,age,props,用处,ReactDom From: https://www.cnblogs.com/alannero/p/18074090