Next.js Discord

Discord Forum

Detect if dynamically imported component has loaded in Nextjs

Unanswered
aprilia posted this in #help-forum
Open in Discord

6 Replies

Avatar
Yacare Caiman
Did you find anything?
It would be nice if Next exposed something to detect whether the loading is done...
Avatar
American black bear
maybe create a context and add a useEffect in dynamically imported component that changes the context value of isLoaded state once the component mounts?
Avatar
Yacare Caiman
Yeah, thats what they suggested in the stackoveflow thread. That should work. But unfortunately that doesn't seem that clean 😦
Avatar
American black bear
that is pretty clean, I don't see any other way
The other way can maybe be react suspense