我需要在react 16.6.3中调试Lazy,Suspense fallback
需要更新加载界面。
寻找最佳解决方案。
https://reactjs.org/blog/2018/10/23/react-v-16-6.html#reactlazy-code-splitting-with-suspense
答案 0 :(得分:1)
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>;
}