with props example
Example 1: props in react
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
function App() {
return (
<div>
<Welcome name="Sara" /> <Welcome name="Cahal" /> <Welcome name="Edite" /> </div>
);
}
ReactDOM.render(
<App />,
document.getElementById('root')
);
Example 2: react props
Props is a way to transform data from one component to another.
<Ball numbre = '1'/>
//IN component
{this.props.numbre} // in html is 1