react componentes code example
Example 1: react fun tion
// it a component
import React from 'react';
class App extends React.Component {
//call function (ECMAScript 5) from tag input:text
handleChange = e => {
//
console.log(`${e.target.value}`)
}
render() {
return (
<div className="App">
<input type="text" name="input" id="" placeholder="" onChange={this.handleChange}/>
</div>
);
}
}
export default App;
Example 2: class app extends component syntax
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}
Example 3: react component example
const element = <div />;