Next.js Discord

Discord Forum

Server Component Build Error For Type Check

Unanswered
Segugio Maremmano posted this in #help-forum
Open in Discord
Avatar
Segugio MaremmanoOP
Is there any problem in this code? Previously there was no issue on docker build. But last couple of days in my various project I'm getting the same error that I can not use Server Component as ReactNode.
import { Suspense } from "react";
import Customers from "../_utils/customers/customers";
import Settings from "../_utils/settings/settings";

const Page = ({ params }: { params: { slug: string } }) => {
  const path = params.slug.replaceAll("-", "");
  return (
    <Suspense fallback={null}>
      {components[path || "customers"]}
    </Suspense>
  );
};
export default Page;

const components: Record<string, React.ReactNode> = {
  customers: <Customers />,
  settings: <Settings />
};
Image

2 Replies