简体   繁体   English

在尝试导入 React 时创建 JSX 文件给我一个错误

[英]Creating JSX files giving me an error while trying to import React

I usually create js files so this is my first time creating jsx files.我通常创建 js 文件,所以这是我第一次创建 jsx 文件。 Is there some lint settings I need to change to prevent it from giving me errors?我需要更改一些 lint 设置以防止它给我错误吗?

I only have this written in the Header component:我只在 Header 组件中写了这个:

```import React from "react";

const Header = () => {
    return (
        <h1>Header</h1>
    )
}

export default Header;

错误

You are using deprecated "babel-eslint".您正在使用已弃用的“babel-eslint”。 Try with "@babel/eslint-parser"尝试使用“@babel/eslint-parser”

https://github.com/eslint/eslint-scope/issues/77#issuecomment-1133775347 https://github.com/eslint/eslint-scope/issues/77#issuecomment-1133775347

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM