import React, {lazy, Suspense} from 'react';
const OtherComponent = lazy(() => import('./OtherComponent'));
function MyComponent() {
return (
<Suspense fallback={<Fallback />}>
<OtherComponent />
</Suspense>
);
}
function Fallback() {
// debug it here to your heart's content
// same thing with "OtherComponent", debug it in component
return <div>Loading...</div>;
}