使用方式
export function createRef(): RefObject {
const refObject = {
current: null,
};
if (__DEV__) {
Object.seal(refObject);
}
return refObject;
}const LazyComp = lazy(() => import("./lazy.js"));
export default () => (
<Suspense fallback="loading data">
<SuspenseComp />
<LazyComp />
</Suspense>
);
import React from "react";
export default () => <p>Lazy Comp</p>;最后更新于