class AsyncLoginPage extends PureComponent {
componentDidMount() {
import("./LoginPage").then(({ default: Component }) => {
this.Component = Component;
this.forceUpdate();
});
}
render() {
const Component = this.Component;
return Component ? <Component {...this.props} /> : null;
}
}
지연 로딩으로 구현하기
- 해당 컴포넌트에 접근하기 전까지 컴포넌트를 임포트하지 않으므로 줄일 수 있다.
next.js
netlify
,S3