Props
Props pass data from parent to child. They are read only.
Example
function Greet({ name, age = 18 }) {
return <p>{name} is {age}</p>;
}
function App() {
return <Greet name="Ada" age={30} />;
}Exercise
Default prop.
function G({ n, age 18 })
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.