How to use JSX in a script? #13069
-
When I used create-vue to create a project, I chose to add JSX. But when I tested using JSX, I got an error and the following prompt. I want to ask if I need to add any additional configurations to use JSX properly
image
image
I tried to add the following configuration in tsconfig.json, but still couldn't solve the problem:
"compilerOptions": {
"types": ["element-plus/global"],
"jsx": "preserve",
"jsxImportSource": "vue"
}
Beta Was this translation helpful? Give feedback.
All reactions
To use JSX in your script, you need to declare the pre-processor language as tsx
or jsx
using the lang
attribute. Here's an example: Playground
-<script setup lang="ts"> +<script setup lang="tsx">
Replies: 1 comment 1 reply
-
To use JSX in your script, you need to declare the pre-processor language as tsx
or jsx
using the lang
attribute. Here's an example: Playground
-<script setup lang="ts"> +<script setup lang="tsx">
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you very much for your help
Beta Was this translation helpful? Give feedback.