Guest User

Untitled

a guest
Sep 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. import React, { Component } from 'react';
  2.  
  3.  
  4. class Demo extends Component{
  5.  
  6. render(){
  7. const STYLING = {
  8. color: 'hsla(0deg, 50%, 100%, 0.72)',
  9. backgroundColor: 'cornflowerblue'
  10. }
  11.  
  12. return (
  13. <div>
  14. {/*
  15. Comments inside curly braces
  16. ONE root tag in the return
  17. class attribute becomes className
  18. Use parentheses around the whole return object
  19. curly braces around expressions
  20. No quotes around attribute value if it is an expression
  21. Handling style objects with JS styleNames
  22. */}
  23. <h1 className="BigHead">Bighetti</h1>
  24. <h2 style={STYLING}>Five times five is { 5 * 5 }.</h2>
  25. <p title="with quotes" data-thing={17 * 85}>Hello world</p>
  26. </div>
  27. )
  28. }
  29. }
  30.  
  31. export default Demo;
  32.  
  33.  
  34. /**
  35. let div = React.createElement('div', {className: 'App'},
  36. [React.createElement('header', {className: 'App-header'},
  37. [React.createElement('img', {src: logo,
  38. className: 'App-logo',
  39. alt: 'Logo'}, null),
  40. React.createElement('h1', {className: 'App-title'}, 'Welcome to React')
  41. ]),
  42. React.createElement('p', {className: 'App-intro'},
  43. ["To get started, edit ",
  44. React.createElement('code', null, 'src/App.js'),
  45. " and save to reload."])]);
  46. ***/
Add Comment
Please, Sign In to add comment