【发布时间】:2017-09-30 07:30:51
【问题描述】:
嘿,我正在使用 react-app 做一个小项目,我 整天都在尝试为this module 创建导出。
我已经用 npm 安装了它,我想编辑它,以便我可以在我的 app.js 中导入和使用它
我尝试使用 class\function\let 定义“reddit”并使用:
export default
module.exports
还有一个
import reddit from 'reddit.js';
var reddit = require('reddit.js');
并尝试使用模块中的一个简单函数进行检查:
console.log(reddit.hot('cats'));
但我仍然得到:
Uncaught TypeError: reddit.hot is not a function
我有点迷茫,我做错了什么?
【问题讨论】:
标签: javascript node.js reactjs create-react-app reddit