Detect if dynamically imported component has loaded in Nextjs
Unanswered
aprilia posted this in #help-forum
apriliaOP
Basically this https://stackoverflow.com/questions/60301416/detect-if-dynamically-imported-component-has-loaded-in-nextjs
in search of a better solution
in search of a better solution
6 Replies
Yacare Caiman
Did you find anything?
It would be nice if Next exposed something to detect whether the loading is done...
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?@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?
Yacare Caiman
Yeah, thats what they suggested in the stackoveflow thread. That should work. But unfortunately that doesn't seem that clean 😦
American black bear
that is pretty clean, I don't see any other way
The other way can maybe be react suspense