Skip to content
Advertisement

React Simple Compont is not rendering inside the browser

Hi have create a sample function and called inside the RenderDOM

But seeing in the brower end the output is not showing

Do anyone have any suggestion

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';

function wwhello(){
  return <div>
          <h1>Hello</h1>
          <p>Summa</p>
        </div>;
}


ReactDOM.render(
  <wwhello/>,
  document.getElementById('root')
);

What is wrong with this code

Advertisement

Answer

React component needs to be in capitalizing first letter:

You can see it in the log error:

Warning: The tag <wwhello> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.
    at wwhello

So change it to:

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

function Wwhello(){
  return <div>
            <h1>Hello</h1>
            <p>Summa</p>
         </div>;
}


ReactDOM.render(
  <Wwhello/>,
  document.getElementById('root')
);
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement