0 votes
in ReactJS by

How to embed two components in One component?

1 Answer

0 votes
by
import React from 'react';

class App extends React.Component{

    render(){

        return(

            <div>

            <Header/>

            <Content/>

            </div>

        );

    }

}

class Header extends React.Component{

    render(){

        return(

            <div>

            <h1> Header</h1>

            </div>

        )

    }

}

class Content extends React.Component{

    render(){

        return(

            <h2>Content</h2>

            <p>The Content Text!!!</p>

            </div>

        )

    }

}

export default App;

Related questions

0 votes
asked Dec 13, 2023 in Angular by DavidAnderson
0 votes
asked Nov 3, 2023 in ReactJS by AdilsonLima
0 votes
asked Mar 2, 2020 in ReactJS by RShastri
...