×

Html & Html5

The World's best Software Development Study Portal

Class Components

Class Components can receive props as input properties(which refers to as props) and return html . Apart from props a class components can also maintain private internal state. It can miantain some information which is private to that components and use that information to describe the interface. Lets create a file inside the component folder Welcome.js

import React, { Component } from 'react'
class Welcome extends Component {
render(){
return < h6 >Welcome < h6 >
}
}
export default Welcome

Now go inside App.js include Welcome Components in the App Components.

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Greet from './components/Greet'
import Welcome from './components/Welcome'
class App extends Component {
render() {
return (


< Greet />
< Welcome />

);
}
} export default App;



Output - Welcome