if your now component props is
{
booking: 4,
isDisable: false
}
you can use this props in your child compoenet
<div {...this.props}> ... </div>
in you child component, you will receive all your parent props.
https://reactjs.org/docs/jsx-in-depth.html
https://zh-hans.reactjs.org/docs/jsx-in-depth.html
https://stackoverflow.com/questions/28452358/what-is-the-meaning-of-this-props-in-reactjs
const person = {
name: "xgqfrms",
age: 23,
country: "China"
};
class TestDemo extends React.Component {
render() {
const {name, age, country} = {...this.props};
// const {name, age, country} = this.props;
return (
<div>
<h3> Person Information: </h3>
<ul>
<li>name={name}</li>
<li>age={age}</li>
<li>country={country}</li>
</ul>
</div>
);
}
}
ReactDOM.render(
<TestDemo {...person}/>
, mountNode
);
网友评论