Next.js Discord

Discord Forum

Element type is invalid

Unanswered
Channel catfish posted this in #help-forum
Open in Discord
Channel catfishOP
hi when I use Badge in the EcommerceMetrics I get the this error =>
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `EcommerceMetrics`.
,EcommerceMetrics this like
EcommerceMetrics=>import { Badge } from "../ui/badge";
export const EcommerceMetrics = () => {
,Badge this like
export const Badge: React.FC<BadgeProps> = ({
  variant = "light",
  color = "primary",
  size = "md",
  startIcon,
  endIcon,
  children,
}) => {
my folder like in the photo .

2 Replies

Channel catfishOP
I think you can fix this by changing to declaring the Components in the function declaration syntax. function ComponentName(){}

Or if you prefer the variable way, add `ComponentName.DisplayName=“ComponentName”;