Multi Component
ReatcJS 2018
class UserDetails extends React.Component { render(){ return ( <div> <p>Name: {this.props.name}</p> <p>Email: {this.props.email}</p> </div> ) } } class OtherInfo extends React.Component { render(){ return ( <p>role: {this.props.role}</p> ) } } class UserInfo extends React.Component { render(){ return ( <div> <UserDetails name={this.props.name} email={this.props.email}/> <OtherInfo role={this.props.role}/> </div> ) } } ReactDOM.render( <UserInfo name="Antonio" email="Antonio@gmail.com" role="1"/> ,document.getElementById('root'));
0 nhận xét:
Post a Comment