Not Capitalizing Component Name

The name of every React component must begin with a capital letter otherwise if we used that component then the browser will treat that component as a built-in element such as span or div, and you may get the warning.

Example: If we create a component named chart and try to render <chart/>, React will ignore this component, and we will get the following warning: 

[WARNING] The tag <chart> is unrecognized in this browser. If you meant to render a 
React component, start its name with an uppercase letter. To avoid this kind of warning,
always start the React component name with the upper case letter. 

Most Common Mistakes That React Developers Make

React is a JavaScript library for building user interfaces. During the process of developing a React app, we made a lot of common mistakes. That’s not a problem that we make mistakes, but it’s always a problem more than anything else if we don’t learn something by making a mistake. In this article, we will learn about the Top 5 most common mistakes that React developers make.

Some mistakes that react developers makes are given below:

Table of Content

  • Fail to Proper Structure Application:
  • Not Capitalizing Component Name:
  • Using class instead of className:
  • Calling Hooks from Class Components
  • Not using key props when using Array map method 

Similar Reads

1. Fail to Proper Structure Application:

There are two ways of writing applications: putting everything in one big component (monolith), or splitting everything into smaller components (micro-services). Beginners often do not build enough, this makes their code more complicated. One of the most important features of React is the component. By design, the React applications are designed to be divided into separate components....

2. Not Capitalizing Component Name:

The name of every React component must begin with a capital letter otherwise if we used that component then the browser will treat that component as a built-in element such as span or div, and you may get the warning....

3. Using class instead of className:

While specifying the class name of the element in React, beginners use class instead of className and this gives them errors. As class keyword is already reserved in JavaScript and JSX is nothing but an extension of JavaScript that’s why React uses className instead of class....

4. Calling Hooks from Class Components

...

5. Not using key props when using Array map method

Hooks allow us to write better React code and make use of state and component life cycle methods inside functional components. But sometimes, you may call hooks from class components, and you may get errors.  React provides many hooks like useEffect, useState, useRef, and many more. But we can use these hooks only inside functional components....

Contact Us