use props react code example
Example 1: react class component
class Welcome extends React.Component {
render() {
return <h1>Bonjour, {this.props.name}</h1>;
}
}
Example 2: pass props in react
const expression = 'Happy';
<Greeting statement='Hello' expression={expression}/>
class Greeting extends Component {
render() {
return <h1>{this.props.statement} I am feeling {this.props.expression} today!</h1>;
}
}
Example 3: créer composant react
1. Dans le terminal :
npx create-react-app [ nom dossier]
cd [ nom dossier]
npm start
2.désinstaller package :
npm uninstall -g create-react-app
Example 4: react component example
const element = <div />;
Example 5: react props
Props is a way to transform data from one component to another.
<Ball numbre = '1'/>
{this.props.numbre}
Example 6: react props
Props is a way to transform data from one component to another.