create a component and render it to the page:
class person extends React.Component{
constructor(name,age)
{
this.name = name;
this.age = age;
}
render(){
return( <div>{this.props.name}--{this.props.age}</div>);
}
}
const data = {
name:"",
age:12
}
ReactDom.render(<Person {...data}></Person>,document.getElementById("app") )
my question is,
. Stands for the expansion operator, here I understand. Data is equivalent to assigning data to deconstruction, right? ,
if it is a deconstruction assignment,
ReactDom.render(<Person { "name":"","age":12 }></Person>,document.getElementById("app") )
, why is it wrong to write like this?
<Movie name={user.name} age={user.age} gender={user.gender}></Movie>
it must be written in this way to be correct. It"s confusing here. I don"t know this.". What exactly did the symbol do,