0

I am trying to load a component:

'use client';
import { dynamic } from 'next/dynamic';
import { useFormState } from 'react-dom';
import { postAction } from '@/lib/actions';
import BlogForm from '@/components/blogs/blog-form/blog-form';

const NewBlog = () => {
    const [state, formAction] = useFormState(postAction, { message: null });
    const BlogForm = dynamic(
        import('@/components/blogs/blog-form/blog-form'),
        { ssr: false }
    );
    return (
        <>
            <BlogForm />
        </>
    )
}
export default NewBlog;

However, I get this error as output:

TypeError: (0 , next_dynamic__WEBPACK_IMPORTED_MODULE_1__.dynamic) is not a function

I am not sure what is causing the issue, I have followed the Nextjs docs and I have not come across is anyone else who had this problem?

I am using React 19 & Next 15.

1 Answer 1

0

You should use default import of dynamic:

import dynamic from 'next/dynamic';

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.