修改Route.js
问题:×
Unhandled Rejection (TypeError): callback is not a function. (In ‘callback(null, webpack_require(/! ./pages/NotFound.js / “./src/pages/NotFound.js”).default)’, ‘callback’ is undefined)
解决:
(1)报错部分1
2
3
4
5
6
7
8
9
10const Routes = () => (
<Router history = {history} createElement = {createElement}>
<Route path="/" component={App}>
<IndexRoute getComponent={getHomePage}/>
<Route path="home" getComponent={getHomePage}/>
<Route path="about" getComponent={getAboutPage}/>
<Route path="*" getComponent={getNotFoundPage()}/> //报错
</Route>
</Router>
)
(2)修改后1
2
3
4
5
6
7
8
9
10const Routes = () => (
<Router history = {history} createElement = {createElement}>
<Route path="/" component={App}>
<IndexRoute getComponent={getHomePage}/>
<Route path="home" getComponent={getHomePage}/>
<Route path="about" getComponent={getAboutPage}/>
<Route path="*" getComponent={getNotFoundPage}/>
</Route>
</Router>
)