简体   繁体   English

'Form' 已定义但从未使用 no-unused-vars

[英]'Form' is defined but never used no-unused-vars

I keep on getting the error Form' is defined but never used no-unused-vars and it says: Search for the keywords to learn more about each warning.我不断收到错误 Form' is defined but never used no-unused-vars 它说:搜索关键字以了解有关每个警告的更多信息。
To ignore, add // eslint-disable-next-line to the line before.要忽略,请将 // eslint-disable-next-line 添加到前一行。

Form.js //to create a form Form.js //创建一个表单

import React from "react";

const Form=() =>{
    return(
        <form>
            <input type="text" class="todo-input"></input>
            <button class="todo-button" type="submit">
                <i class="fas fa-plus-square"></i>
            </button>
            <div class="select">
                <select name="todos" class="filter-todos">
                    <option value="all">All</option>
                    <option value="completed">Completed
                    </option>
                    <option value="uncompleted">Uncompleted</option>
                </select>
            </div>
        </form>
    )
}
export default Form; 

App.js //main file
import React from "react";
import './App.css';
import Form from './components/form';
function App() {
  return (
    <div className="App">
      <header>Todo List</header>    
    </div>
  );
}

export default App;

`

Because eslint configured to catch unused variables.因为 eslint 配置为捕获未使用的变量。 you are not using the Form component in the App.js so it's just says a message您没有在 App.js 中使用 Form 组件,所以它只是说一条消息

You have create a form component but component not use so its gives the warning so please ignore this warn.您已经创建了一个表单组件,但该组件未使用,因此它会发出警告,因此请忽略此警告。

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

相关问题 定义了“标头”,但从未使用过未使用的变量 - 'Header' is defined but never used no-unused-vars &#39;Home&#39; 已定义但从未使用 no-unused-vars&quot;.* - 'Home' is defined but never used no-unused-vars".* &#39;已定义但从未使用过 no-unused-vars&#39;,已定义但从未使用过 no-unused-vars - 'is defined but never used no-unused-vars', is defined but never used no-unused-vars &#39;UserInput&#39; 已定义但从未使用过 no-unused-vars &#39;UserOutput&#39; 已定义但从未使用过 no-unused-vars - 'UserInput' is defined but never used no-unused-vars 'UserOutput' is defined but never used no-unused-vars 第 3:9 行:'home' 已定义但从未使用 no-unused-vars - Line 3:9: 'home' is defined but never used no-unused-vars &#39;FC&#39; 已定义但从未使用过.eslint (no-unused-vars) - 'FC' is defined but never used.eslint (no-unused-vars) 编译错误:已定义但从未使用 no-unused-vars - Compilation Error: is defined but never used no-unused-vars 组件已定义但从未使用 reactjs 中的 no-unused-vars 错误警告 - component is defined but never used no-unused-vars error warning in reactjs 警告&#39;ScrollingHorizo​​ntally&#39;已定义,但从未使用过no-unused-vars - warning 'ScrollingHorizontally' is defined but never used no-unused-vars React,定义了警告“css”但从未使用过 no-unused-vars - React, warning 'css' is defined but never used no-unused-vars
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM