Kar*_*k S 17 typescript next.js react-typescript
我正在构建一个基于 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>
Run Code Online (Sandbox Code Playgroud)
这是我的代码
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
Run Code Online (Sandbox Code Playgroud)
该文件被命名index.tsx并位于内部src/components/useCase
TS配置:
{
"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"]
}
Run Code Online (Sandbox Code Playgroud)
我尝试了一些建议
但他们似乎都不在这里工作
| 归档时间: |
|
| 查看次数: |
29144 次 |
| 最近记录: |