简体   繁体   English

eslint为“ App”分配了带有react的警告

[英]eslint 'App' is assigned warning using with react

I don't see any problem with my code, App is a component and it's used, but eslint gave me this warning 我的代码没有任何问题,App是一个组件并且已使用,但eslint给了我这个警告

./src/containers/app/index.js
  Line 6:  'App' is assigned a value but never used  no-unused-vars

my code 我的密码

import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { ConnectedRouter } from 'react-router-redux'
import store, { history } from './store'
import App from './containers/app'

import './index.css'

const target = document.querySelector('#root')

render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <div>
        <App />
      </div>
    </ConnectedRouter>
  </Provider>,
  target
)

Any clue how to fix that for react? 任何线索如何解决该反应?

The standard ESLint rules don't know anything about JSX. 标准的ESLint规则对JSX一无所知。 You'll need to use https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md in order to get the behavior you want. 您需要使用https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md来获得所需的行为。

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

相关问题 运行 eslint 时在“eslint-plugin-react-settings”中收到警告 - Getting warning in 'eslint-plugin-react-settings' while running eslint [eslint] src\App.js 第 2:8 行中的 React js 错误警告:'person' 已定义但从未使用过 - React js error WARNING in [eslint] src\App.js Line 2:8: 'person' is defined but never used “&#39;React&#39; 在定义之前就被使用了。” eslint 警告 - “'React' was used before it was defined.” eslint warning 关闭 ESLint 规则(在 React 应用程序中,使用 WebStorm) - Turn off ESLint rule (in React app, using WebStorm) 使用React在ToDo App中使用setState警告 - setState warning in ToDo App using React ESLint 错误 - ESLint 找不到配置“react-app” - ESLint error - ESLint couldn't find the config "react-app" Eslint React Hooks错误:eslint-plugin-react-hooks用尽详尽的警告警告useEffect中的功能依赖项 - Eslint React Hooks Error: eslint-plugin-react-hooks exhaustive deps warning for a function dependency in useEffect ESLint 是如何集成到 Create React App 中的? - How is ESLint integrated into Create React App? 在 useEffect 中使用道具时禁用 eslint 警告 - Disabling eslint warning when using props inside useEffect 关于解构的警告 - Eslint warning about deconstruction
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM