我使用教程這裏找到:module.exports不工作ES6
https://github.com/reactjs/react-router-tutorial/blob/master/lessons/14-whats-next/modules/routes.js
然而,當複製:
module.exports = (
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="/repos" component={Repos}>
<Route path="/repos/:userName/:repoName" component={Repo}/>
</Route>
<Route path="/about" component={About}/>
</Route>
)
Webstorm是突出的支架和使用:
import React from 'react'
import { Router, browserHistory } from 'react-router'
import routes from './routes'
但是路線拋出錯誤
Default export is not declared in imported module
頁面只是空白,沒有反應代碼。爲什麼我不能像教程代碼中所示那樣導出模塊?
我的代碼的其餘部分是ES6
顯示您的package.json – pmirnd