2
我想创建一个utils.js,其中包含我的许多React组件使用的所有实用功能。在React-Rails应用程序中的React ES6组件之间导出/导入实用程序功能
我尝试导出和导入实用程序类为我的阵营组成是这样的:
// utils. js
export default class Utilities;
// myComponent.es6.jsx
import someFunction from 'Utilities';
我收到类似这样的错误:
Uncaught ReferenceError: require is not defined(anonymous function)
Uncaught ReferenceError: exports is not defined
如何建立一个独立的事业页然后可以导入到我的React组件中?
我很困惑 - 感谢您提供的任何帮助!
谢谢,oreoluwa!对此,我真的非常感激。 –