Next.js Discord

Discord Forum

Explain differences in dynamic() function

Unanswered
Raspberry Horntail posted this in #help-forum
Open in Discord
Raspberry HorntailOP
 

import dynamic from 'next/dynamic';

const MyComponent = dynamic(() => import('../components/MyComponent'),{ssr:true});

const Page = () => (
  <div>
    <h1>Hello next</h1>
    <MyComponent />
  </div>
);

export default Page;
///second 
import MyComponet from "MyComponent"


const Page = () => (
  <div>
    <h1>Hello next</h1>
    <MyComponent />
  </div>
);
any difference next js 14?

1 Reply

The second will not work I think