Description

Solution

Submissions

Overview

Add props
  • Props (properties) let a parent component send data to its children.

    javascript

    // App.js <Greeting name="TechPrep" />
Parameter destructuring
  • Greeting receives the prop (via parameter destructuring) and injects it into the markup:

    javascript

    function Greeting({ name }) { return <h1>Hello, {name}!</h1>; }
App.js
import Greeting from "./Greeting";

export default function App() {
  return (
    <div className="App p-3">
      <Greeting />
    </div>
  );
}

Browser

Console

Test Cases

Submit

JavaScript Console

console.log()
statements will appear here

Run Tests

Click the 'Run' button below to run the tests
in the run.test.js file

Submit

Click the 'Submit' button below to submit your solution

Open browser consoleTests