JSX Element type ‘void’ is not a constructor function for JSX elements [duplicate]

Items is an arrow function with {} which means you have to explicitly give it a return statement:

export const Items = ({icon, title}: LinkedItemProps) => {
  return ( // <------ must return here
    <div>
      <div className="nav-menu-link-icon">
        {icon}
      </div>
      <div className="nav-menu-link-label">
        {title}
      </div>
    </div>
  )
}

If you do not, then the Items just returns undefined which is an empty value and thus

JSX Element type 'void' is not a constructor function for JSX elements"

For a bit cleaner code, you can replace the {} with () completely:

export const Items = ({icon, title}: LinkedItemProps) => ( 
  <div>
    <div className="nav-menu-link-icon">
      {icon}
    </div>
    <div className="nav-menu-link-label">
      {title}
    </div>
  </div>
)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)