Next.js Discord

Discord Forum

dynamic import vs Suspense?

Unanswered
Fire ant posted this in #help-forum
Open in Discord
Fire antOP
Which one should be used to import component which uses await promise functions?

7 Replies

@Fire ant Which one should be used to import component which uses await promise functions?
I think Suspense is what you looking for. dynamic is for lazy loading
@Ray I think `Suspense` is what you looking for. `dynamic` is for lazy loading
Fire antOP
what about dynamic? i see on tutorial it reduces page size due to lazy load
@Fire ant what about dynamic? i see on tutorial it reduces page size due to lazy load
yes it is for lazy loading which only import the component when it is going to show on screen
so it reduces the first load javascript size
@Ray yes it is for lazy loading which only import the component when it is going to show on screen
Fire antOP
so which one better for await promise component? Suspense?