Next.js Discord

Discord Forum

useMemo not callable error

Unanswered
Japanese jack mackerel posted this in #help-forum
Open in Discord
Japanese jack mackerelOP
here is my code
import useMemo from "react";
import dynamic from "next/dynamic";

export default function Home(props: any) {


  const Map = useMemo(() => dynamic(
    () => import('@/components/Map'),
    { 
      loading: () => <p>A map is loading</p>,
      ssr: false
    }
  ), [])

  return <div>
    <Map />
  </div>
}

im getting an error on useMemo that the function isnt callable and has no call signatures. i tried looking it up and it seems the error might come from typescript not knowing what type it is? here is the ref url i found for the problem https://github.com/pmndrs/jotai/issues/802
but im not sure what type id make useMemo as im returning a custom component, would it be string?

0 Replies