new component react code example
Example 1: class app extends component syntax
class Welcome extends React.Component {
render() {
return Hello, {this.props.name}
;
}
}
Example 2: how to create component in reactjs
class Car extends React.Component {
render() {
return Hi, I am a Car!
;
}
}
Example 3: react class component
class Welcome extends React.Component {
render() {
return Bonjour, {this.props.name}
;
}
}
Example 4: 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