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>
- </>
- )
- }
- }
- class Clock extends React.Component {
- constructor(props){
- super(props);
- this.state = {
- date: new Date();
- }
- }
- render(){
- return(
- <div>{this.state.date.toLocalTimeString}</div>
- )
- }
- }
- ReactDOM.render(
- <Component name = 'Wojtek' loading ={false}>Test</Component>,
- document.getElementById('app')
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement