Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class Component extends React.Component {
  2. render(){
  3. return (
  4. <>
  5. <h1>hello, {this.props.name}</h1>
  6. <h2>{this.props.loading ? 'Loading..': this.props.children}</h2>
  7. </>
  8. )
  9. }
  10. }
  11.  
  12.  
  13. class Clock extends React.Component {
  14. constructor(props){
  15. super(props);
  16. this.state = {
  17. date: new Date();
  18. }
  19. }
  20.  
  21. render(){
  22. return(
  23. <div>{this.state.date.toLocalTimeString}</div>
  24. )
  25. }
  26. }
  27.  
  28.  
  29. ReactDOM.render(
  30. <Component name = 'Wojtek' loading ={false}>Test</Component>,
  31. document.getElementById('app')
  32. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement