Friday, 28 January 2022

Class Component with hard code data

 import React from 'react';

import './Header.css';


class Header extends React.Component{

    render() {

      return (

        <div className='title'>

        <h2>React Demo</h2>

        <p>Welcome to react Tutorial</p>

    </div>

      );  

    }

}

export  default Header;


Import same Header class in App.js file as follows-


import './App.css';

import State from './Components/Header/Header.js';


function App() {

  return (

    <div className="App">

     <Header/>

    </div>

  );

}

export default App;



PostedBy: pankaj_bhakre

No comments:

Post a Comment