첫 커밋
This commit is contained in:
17
src/widgets/loadable/index.tsx
Normal file
17
src/widgets/loadable/index.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Suspense } from 'react';
|
||||
|
||||
import { Loading } from '@/widgets/loading/loading';
|
||||
|
||||
export const Loadable = (Component: React.ComponentType<any>) => {
|
||||
const LoadableComponent = (props: any) => {
|
||||
return (
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Component {...props} />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
LoadableComponent.displayName = `Loadable(${Component.displayName || Component.name || 'Component'})`;
|
||||
|
||||
return LoadableComponent;
|
||||
};
|
||||
Reference in New Issue
Block a user