#React Components
In general, there are 2 ways to create React Component
.
Here an extension of react component, we can do all sort of things, but for class component, it always going need to render()
, to return a component.
Note, this component will can have state
.
import React from 'react';
class App extends React.Component {
render() {
return (<h1> Hello, Roy </h1>);
}
}
export default App;
import React from 'react';
class App extends React.Component {
render() {
return React.createElement('h1', null, 'Hello, Roy');
}
}
export default App;
Note, this component will not able to hold any state
.
import React from 'react';
const App = () => <h1>Hello, Roy</h1>
export default App;