React Components
class App extends Component {
constructor() {
super()
this.state = {
name: "Sally",
age: 13
}
}
render() {
return (
<div>
<h1>{this.state.name}</h1>
<h3>{this.state.age} years old</h3>
</div>
)
}
}class MyComponent extends React.Component{
constructor(props){
super(props);
};
render(){
return(
<div>
<h1>
My First React Component!
</h1>
</div>
);
}
};
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}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')
);const component = () => {
console.log("This is a functional Component");
}class Car extends React.Component {
render() {
return <h2>Hi, I am a Car!</h2>;
}
}
Also in JavaScript:
- loop json object android java
- moving a item fro index to another index, javascript
- make page refresh on top in react js
- split string into char array javascript
- db.json
- firebase react js
- Javascript compare two dates
- disable autocomplete javascript
- Run project in visual studio with iis express
- detect mouse javascript
- route in component react
- set checkbox checked jquery
- Javascript pong game
- how get height elemnt with that margin in js
- simulate click jest
- output event angular
- exponent of two numbers in javascript
- age calculator javascript
- js filter array
- get last day of month javascript
- how to add bootstrap in angular
- promise in javascript
- afficher une variable dans la console javascript
- javascript calculate age