Property ‘classname’ does not exist on type ‘intrinsicattributes’.

Query: property ‘classname’ does not exist on type ‘intrinsicattributes’

This error message is seen when trying to assign a value to the “className” property within a JSX element,
but the compiler does not recognize the property “classname”. The property should be written as “className”
instead in JSX, following the convention of HTML element attributes.

Example:

    
      import React from 'react';

      const MyComponent = () => {
        return (
          

Hello World!

); } export default MyComponent;

In this example, the error occurs because the “classname” property is used instead of “className” within the “div” element.
To fix the error, simply change “classname” to “className”:

    
      import React from 'react';

      const MyComponent = () => {
        return (
          

Hello World!

); } export default MyComponent;

Once the correction is made, the error should disappear, and the component can be used without any issues.

Leave a comment