如何在 React 16.6.3 中调试 Lazy、Suspense 回退

How to debug Lazy, Suspense fallback in react 16.6.3

我需要在 React 16.6.3 中调试 Lazy、Suspense 回退

需要更新加载UI。

正在寻找最佳解决方案。

https://reactjs.org/blog/2018/10/23/react-v-16-6.html#reactlazy-code-splitting-with-suspense

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>;
}