Skip to main content

Properties (props)

Properties are the parameters of a React function (component).

This is a way for parent components to pass data to child components. /!\ Properties are immutable (unchangeable) in the child component.

Example

function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}

function App() {
return (
<div>
<Welcome name="Code" />
<Welcome name="pro" />
<Welcome name="Exodius" />
</div>
);
}

If we have data that has updates, we must use a state.