Props

Pascual Vila
Frontend Instructor.
Props (properties) are a way to pass data from a parent component to a child component in React. Props are immutable, meaning they cannot be changed from the child component, but they can be used to dynamically render content in a component.
Passing Props:
- From the parent component: They are passed as attributes to the child component.
- In the child component: They are accessed through the
propsproperty.
Example of Props usage:
{`import React from "react";
function MyComponent({ name }) {
return <h1>Hello, {name};</h1>
}
function App() {
return <MyComponent name="John" />;
}
export default App;`}