通用组件库报错
解决方案 :在 eslint.config.js 或 .eslintrc.js 中配置 globals
在 ESLint 配置文件中(如 .eslintrc.js 或 eslint.config.js),声明 React 作为全局变量:
javascript">module.exports = {globals: {React: "readonly"},extends: ["eslint:recommended", "plugin:react/recommended"],rules: {"no-undef": "off" // 关闭 no-undef 规则,避免 React 误报}
};