简体   繁体   English

`ReferenceError: React is not defined` 在 vue3 jsx 文件中

[英]`ReferenceError: React is not defined` in vue3 jsx files

i am trying to implement storybook with antdv , when I import a tsx file which returns jsx inside button.stories.js, I got "ReferenceError: React is not defined" you can see error here but react is not the part of this project at all, it is a vue js project and all tsx and jsx is returned from tsx files but under the hood they are all vue js files as they use vue js features.我正在尝试使用antdv实现故事书,当我导入一个在 button.stories.js 中返回 jsx 的 tsx 文件时,我得到“ReferenceError: React is not defined”你可以在这里看到错误,但 react 不是这个项目的一部分总而言之,它是一个 vue js 项目,所有 tsx 和 jsx 都是从 tsx 文件返回的,但在幕后它们都是 vue js 文件,因为它们使用 vue js 功能。

all kind of help is appreciated各种帮助表示赞赏

Probably its an error with configuration on JSX transpiler,i think a solution can be import react even if you don't use it import React from 'react';可能是 JSX 转译器上的配置错误,我认为即使您不使用它也可以导入反应解决方案 import React from 'react';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有 create-react-app 的 Emotion.js:ReferenceError:未定义 jsx - Emotion.js with create-react-app: ReferenceError: jsx is not defined Ionic React Typescript 与 pug.js,使用 tsx 而不是 jsx 时出现“未捕获的 ReferenceError:React 未定义” - Ionic React Typescript with pug.js, 'Uncaught ReferenceError: React is not defined' when use tsx but not jsx TypeScript + Vue 3 - ReferenceError:未定义变量 - TypeScript + Vue 3 - ReferenceError: variable is not defined Vue Uncaught ReferenceError:未定义进程 - Vue Uncaught ReferenceError: process is not defined 如何修复 Vue3 中未定义的 defineExpose 方法 - How to fix defineExpose method not defined in Vue3 ReferenceError - 任何未定义(React Js) - ReferenceError - any is not defined (React Js) 如何在 vue3 组件中导入打字稿文件? - How to import typescript files in vue3 component? ReferenceError:MediaStream 未使用 Jest 和 Vue 定义 Typescript - ReferenceError: MediaStream is not defined with Jest and Vue Typescript Typescript ReferenceError: google 未定义,但仅在独立文件中 - Typescript ReferenceError: google is not defined, but only in standalone files React 16.14.0:未捕获错误 ReferenceError:未定义导出 - React 16.14.0: Error was not caught ReferenceError: exports is not defined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM