从另一个 jsx 文件导入所有函数和常量

importing all functions and constants from another jsx file

我想创建一个 jsx 文件,其中包含几个 functions/constants 我想在其他 jsx 文件中使用的文件。我该怎么做才能从该文件中导入所有这些函数和常量?

只需将该函数写为 'export function funcName() { ...code }' 并将其导入为 '@import { funcName } from 'name of folder with index.jsx file ' ' 或 '@import * 与 '/way' 相同 然后你应该得到你的 const 作为 common.varname