webpack2.x
とreact-router-dom
でコード分割がどのように機能するかを調べようとします。react-router-dom、コード分割のための `getComponent`メソッドがありますか?
"react-router-dom": "^4.0.0"
しかし、私はドキュメントを読み、次のように使用する方法が見つかりませんでした:まだ仕事をしたりしませ
getComponent
を?
私はreact-router-dom
の文書がちょっとした例を挙げているだけで、説明はしていません。
私はreact-router
がv4.0.0-beta.8
であると見ましたが、後でreact-router-dom
を使用する必要がありますか?
module.exports = {
path: 'home',
getComponent(nextState, cb) {
import('./main').then(component => {
cb(null, component);
}).catch(err => {
console.log('Failed to load "home" component', err);
});
}
};