0

Here is my code

const templateOne = <div>
    <h1>{app.heading}</h1>
    <p>{app.subHeading}</p>
    <ol>
        <li>Item One</li>
        <li>Item Two</li>
    </ol>
    <form>
        <input type="text"></input>
        <buttton>addOptions</buttton>
    </form>
</div>

ReactDom.render(templateOne, document.getElementById('root))

Then I got the warning i.e react-dom.development.js:82 Warning: The tag is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter in buttton,in form,in div

Hemant
  • 95
  • 5

2 Answers2

1

Correct the spelling of <button>

Man I also got the same warning first..

The problem is that all react components should start with an Uppercase letter.

If you change templateOne to TemplateOne then it should be fine.

Also change it here.

ReactDom.render(TemplateOne, document.getElementById('root))

The warning should disappear.

0

Updated code:-

const MyComponent = <div>
    <h1>{app.heading}</h1>
    <p>{app.subHeading}</p>
    <ol>
        <li>Item One</li>
        <li>Item Two</li>
    </ol>
    <form>
        <input type="text"></input>
        <button>addOptions</buttton>
    </form>
</div>


ReactDom.render(MyComponent, document.getElementById('root));

If the component is creating with the lowercase, react will take it as a normal Html tag. So always create your component starting with uppercase.

read more - ReactJS component names must begin with capital letters?

Sarun UK
  • 6,210
  • 7
  • 23
  • 48