Suspenseのこと
キーワード
CSR(Client Side Rendering)
SPA
lazy, Suspense
export default
サンプル
code:jsx
const OtherComponent = (): JSX.Element => {
return <div>他のコンポーネント</div>
}
export default OtherComponent
code:JSX
import { Suspense, lazy } from 'react'
const OtherComponent = lazy(() => import('./OtherComponent'))
export const Mycomponent = (): JSX.Element {
return (
<div>
<Suspense fallback={<div>Loading...</div>}>
<OtherComponent />
</Suspense>
</div>
)
}