Concept: Props and destructuring
Create a Welcome component that accepts a name prop and displays “Welcome, [name]!” in an <h2> tag.
Use destructuring to extract the name prop.
<Welcome name="Ash" />
// Should display: Welcome, Ash!
<Welcome name="Misty" />
// Should display: Welcome, Misty!
export default function Welcome(/* add props here */) {
// Your code here
}
export default function Welcome({ name }) {
return <h2>Welcome, {name}!</h2>;
}
{ name } to destructure props (modern React pattern){} to embed JavaScript in JSX