React项目中报错解决方案

1、环境介绍:
通过React的官方教程 Create-React-App使用脚手架工具搭建的工程,然后添加了路由组件React-Router,样式组件Antd Design(简称antd)。

2、警告描述:

The href attribute is required for an anchor to be keyboard accessible.
Provide a valid, navigable address as the href value.
If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. 
Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid

3、解决方法:
运行 npm run eject

4、添加配置
在package.json文件中添加如下代码

"eslintConfig": {
    "extends": "react-app",
    "rules":{
      "jsx-a11y/anchor-is-valid":"off"
    }
  }

你可能感兴趣的:(React)