From 6a61a915eaca6ce2b48dd9e8ede59b9b035059de Mon Sep 17 00:00:00 2001 From: Rafael Bardini Date: Tue, 29 May 2018 10:28:24 +0200 Subject: [PATCH] Move module loading to `componentDidMount` --- README.md | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdbcb111..ab4f626d 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ class MyComponent extends React.Component { Bar: null }; - componentWillMount() { + componentDidMount() { import('./components/Bar').then(Bar => { this.setState({ Bar }); }); diff --git a/src/index.js b/src/index.js index a22d69a7..f3a72710 100644 --- a/src/index.js +++ b/src/index.js @@ -149,7 +149,7 @@ function createLoadableComponent(loadFn, options) { return init(); } - componentWillMount() { + componentDidMount() { this._mounted = true; this._loadModule(); }