Next.js Discord

Discord Forum

Type error: Page "..." does not match the required types of a Next.js Page!

So,
I am getting this error when bulding the app:
Type error: Page "src/app/detailed_view/page.tsx" does not match the required types of a Next.js Page.
  "CardDemo" is not a valid Page export field.

Snippet:
type CardProps = React.ComponentProps<typeof Card>

export default function CardDemo({ className, ...props }: CardProps) {
  const searchparams = useSearchParams()
  const name = searchparams.get('name')
Answered by averydelusionalperson
you can't export CardDemo with that props type
View full answer

24 Replies

you can't export CardDemo with that props type
Answer
how will you get Card types props in page.tsx?
no worries, it was simple problem
it's solved I assume?
noice, could you mark the message that helped you as solution?
🫑
It is offtopic from the main reason, but how can i use router in cell function ?
...
export const columns: ColumnDef<Payment>[] = [
  {
    accessorKey: "version",
    header: "Package version",
  },
  {
    accessorKey: "desc",
    header: "Update notes",
  },
  {
    id: "actions",
    header: "Actions",
    cell: ({ row }) => {
      const paket = row.original
      const router = useRouter();
      const handleCopyPackagaName = (dependency) => {
        navigator.clipboard.writeText(dependency)
          .then(() => {
            toast.success("Copied package name!")
          })
          .catch(error => {
            toast.error("Failed to copy the package name...")
          });
      }
...
create a new component/function for the actions component ig?
i'm very fresh in ts
you can create a new <Actions /> component
and in cell function,
return (
<Actions paket={paket} />
)
@πšπš’πš–πšžπš£πš”πšŠπšœ Click to see attachment
yes, you need a component to use hooks, like I said create a new component
sure, ask here if you have any problems
@averydelusionalperson sure, ask here if you have any problems
?
can you share your file, and please create new #help-forum post. since this is a new discussions.