Next.js Discord

Discord Forum

`Component.Skeleton` is undefined after importing

Unanswered
American Chinchilla posted this in #help-forum
Open in Discord
American ChinchillaOP
hey i have a component named ServerList and i assign Skeleton to it this way:
ServerList.Skeleton = function ServerListSkeleton() {
  return (
    <div className="flex gap-2 items-center justify-center m-12">
      <ServerButton.Skeleton />
      <ServerButton.Skeleton />
      <ServerButton.Skeleton />
      <ServerButton.Skeleton />
      <ServerButton.Skeleton />
      <ServerButton.Skeleton />
    </div>
  )
}


but after using it in loadinx.tsx file

import ServerList from "@/components/ServerList"

export default function Loading() {
  return (
    <div className="...">
      <h1 className="...">...</h1>
      <ServerList.Skeleton />
      <h1 className="...">...</h1>
      <ServerList.Skeleton />
    </div>
  )
}
it says ServerList.Skeleton is undefined. Why? i saw that approach in shadcnui example taxonomy
https://github.com/shadcn-ui/taxonomy/blob/main/components/post-item.tsx#L33

0 Replies