【发布时间】:2017-12-20 23:52:24
【问题描述】:
所以我有这些文件和文件夹。
App.js
modules/
user/
index.js
list.js
在 list.js 我有export default (props) => (...)
在 index.js 我有export UserList from './list';
在 App.js 中我有 import { UserList } from './modules/user';
那里有什么问题吗?因为我得到了
./src/modules/user/index.js
Syntax error: Unexpected token, expected { (1:7)
> 1 | export UserList from './list';
但我看不出这里有什么问题?救命!
编辑:这是我的 list.js 文件的更多详细信息,但我认为这没有什么不同,因为错误在 index.js 中
import React from 'react';
// more import
export default (props) => (
<List {...props}>
...
</List>
);
【问题讨论】:
-
你能分享你的 index.js 或 list.js 吗?有明显的语法错误。
-
@OzgurGUL: "从 './list' 导出用户列表;"就是我的 /modules/user/index.js 的全部内容
-
首先你必须导入它AFAIK:
import UserList from './list; export default UserList -
@T.J.Crowder,啊,很高兴知道,谢谢。
标签: javascript reactjs