Using Webpack and React-router to improve performance with lazy loading
Nadav Dav
1025

Hello, I have a question:

lets supose we have 2 components X and Y, then we remove both of them from the first load, and our router is defined like this:
<Router history={browserHistory}>
 <Route path=”/” {…component(X)}/>
 <Router/>

now, this doesnt work for me…. mostly because inside X i’m calling Y, like this:

import Y from './Y'
class X extends React.Component {
.....
render() {
return (
<div>
<Y />
</div>
);
}
}

do you know why? i’m getting the following error:

Uncaught TypeError: cb is not a function
 at eval (Y.js?./~/bundle-loader?lazy:3)

thanks in advance!

Show your support

Clapping shows how much you appreciated Prince Hernandez’s story.