Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // using props as parameter
  2. function Component (props) {
  3. return (
  4. <div>
  5. Hello {props.name}!
  6. </div>
  7. )
  8. }
  9.  
  10. // using object destructuring
  11. function Component ({ name }) {
  12. return (
  13. <div>
  14. Hello {name}!
  15. </div>
  16. )
  17. }
  18.  
  19. // Component usage
  20. import Component from './Component'
  21. function App () {
  22. return (
  23. <div>
  24. <Component name="Sarah" />
  25. </div>
  26. )
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement