我正在建立一个基于nextjs-typescript和tailwindcss的网站
我遇到了这个奇怪的错误Expression expected
。
我在候机厅也收到了这个:
Unexpected token `div`. Expected jsx identifier
const UseCases = () => {
7 | return (
8 | <div className="relative z-10 bg-gray-100 py-20">
: ^^^
9 | <FadeIntoView>
这是我的密码
import dataUseCases from "../../data/cases.data"
import FadeIntoView from "../../utils/gsap/fadeIntoView"
import Cases from "./useCases"
const UseCases = () => {
return (
<div className="relative z-10 bg-gray-100 py-20">
<FadeIntoView>
<h2 className="xs:text-8xl text-22vw fill-color pb-7 text-right font-black">Case</h2>
<div>
{dataUseCases.map((case, index) => (<Cases key={case.title + "-" + index} index={index + 1} />))}
</div>
</FadeIntoView>
</div>
)
}
export default UseCases
文件名为index.tsx
,位于src/components/useCase
中
配置:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
我尝试了一些建议
swc#issue-2237stack-overflow
但他们好像都不在这儿工作
2条答案
按热度按时间cu6pst1q1#
case
是javascript中保留关键字将Map中的变量更改为其他值iezvtpos2#
中断字节大小写捕获char类 * const continue调试器默认值delete do double else枚举 * eval导出 * extends* false final函数的finally浮点数后藤if implements import* in instanceof int接口let* long本机新空包私有受保护公共返回short static super* 开关synchronized此抛出抛出瞬时真try类型var无效抽象参数wait * boolean volatile while with yield
所有这些
keywords
都是javaScript中保留的,您不能将它们用作变量、标签或函数名