mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
When using `next/dynamic` with `suspense: true`, the API will opt into `React.lazy` with react 18. But previously it doesn't preload the dynamic chunks. This pr will include the chunks into initial html for faster hydration instead of loading the chunk until the script is executed. This makes `next/dynamic` has a significant difference from `React.lazy` api x-ref: https://github.com/vercel/next.js/issues/37197#issuecomment-1138496911 x-ref: https://github.com/vercel/next.js/pull/37244
10 lines
146 B
JavaScript
10 lines
146 B
JavaScript
import dynamic from 'next/dynamic'
|
|
|
|
const Foo = dynamic(() => import('../components/foo'))
|
|
|
|
export default () => (
|
|
<div>
|
|
<Foo />
|
|
</div>
|
|
)
|