0

I am new to ReactJS. This is my first code where I am trying to render two components. I am not getting any error but HTML part is not coming up. DOM is empty. What is wrong here? --

import React from 'react';
import ReactDOM from 'react-dom';

class First extends React.Component{
    render(){
        return (
            <h1>it is about how to render two component. it is first component</h1>
        )
    }
}

class Second extends React.Component{
    render(){
        return (
            <h1>it is about how to render two component. it is second component</h1>
        )
    }
}

class all extends React.Component{
    render(){
        return(
            <section><First /><Second /></section>
        )
    }
}

ReactDOM.render(<all />,document.getElementById('root'));
Aditya Kumar
  • 165
  • 1
  • 1
  • 16

1 Answers1

2

In jsx component names starting with lowercase are considered to be HTML elements.

Changing all to All should work fine.

Please refer the answer, ReactJS component names must begin with capital letters?

Community
  • 1
  • 1
Sridhar Sg
  • 1,546
  • 13
  • 21