Skip to content
Discussion options

You must be logged in to vote

A bit more context — I am importing a component into a "page" in NextJS, and that component is importing my custom hooks with either mutations or queries. A simple workaround is to make these imports dynamic, so as an example.

// page.tsx
// Home page in NextJS importing custom components
const ShowPosts = dynamic(() => import('@/components/ShowPosts'), {
  loading: () => <Spinner />,
  ssr: false,
});

export default function Home() {
  return (
    <main>
      <ShowPosts />
    </main>
  );
}

// ShowPosts.tsx
// Component that is importing my own custom hooks using react-query
export default function ShowPosts() {
  // custom hooks for api calls using queries and mutations
  const { d…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by adamhp
Comment options

You must be logged in to vote
1 reply
@adamhp
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants