Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Component extends React.Component {
- render(){
- return (
- <>
- <h1>Hello, {this.props.name}</h1>
- <h2>{this.props.loading ? 'Loading...' : this.props.children}</h2>
- <Clock/>
- </>
- )
- }
- }
- class Clock extends React.Component {
- constructor(props){
- super(props);
- this.state = {
- date: new Date()
- };
- }
- render(){
- return(
- <h1>{this.state.date.toLocaleTimeString()}</h1>
- )
- }
- }
- ReactDOM.render(
- <Component name="Adam" loading={false}>
- Test
- </Component>,
- document.getElementById("app")
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement