【发布时间】:2018-05-15 13:06:37
【问题描述】:
我有一个这样的文件夹结构:
src\
components\
Home\
index.tsx
redux\
reducer.ts
index.tsx
在./index.tsx
在有
export const App = <p> Hello World </p>
当我尝试在reducer.js 中使用import { App } from ../index.tsx 时说App is undefined
但如果我 import Home from '../components/Home' 效果很好。
可能是什么问题?
【问题讨论】:
-
因为你是
export const App而不是export default const App,所以你需要像import { App } from ../index.tsx一样导入 -
还是不行
-
export const App =
Hello World
是您的确切代码吗? -
不,但这基本上是我的代码