Reputation: 503
I am using the tutorial found here:
https://github.com/reactjs/react-router-tutorial/blob/master/lessons/14-whats-next/modules/routes.js
However when copying:
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 is highlighting the brackets and using:
import React from 'react'
import { Router, browserHistory } from 'react-router'
import routes from './routes'
But routes throws the error
Default export is not declared in imported module
The page just loads blank with no react code. Why can I not export the module as shown in the tutorial code?
The rest of my code is ES6
Upvotes: 1
Views: 2067
Reputation: 503
rselvaganesh is technically correct, however in this case it should be:
export default (
<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>
)
with no name - which is what was confusing me
Upvotes: 2
Reputation: 1122
This issue was posted here
Changing in AppActions
module.exports = alt.createActions(AppActions);
To:
export default alt.createActions(AppActions);
Makes WebStorm happier and doesn't seem to break anything.
Upvotes: 2