Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // using props as parameter
- function Component (props) {
- return (
- <div>
- Hello {props.name}!
- </div>
- )
- }
- // using object destructuring
- function Component ({ name }) {
- return (
- <div>
- Hello {name}!
- </div>
- )
- }
- // Component usage
- import Component from './Component'
- function App () {
- return (
- <div>
- <Component name="Sarah" />
- </div>
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement