简体   繁体   中英

'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.
To ignore, add // eslint-disable-next-line to the line before.

Form.js //to create a form

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. you are not using the Form component in the App.js so it's just says a message

You have create a form component but component not use so its gives the warning so please ignore this warn.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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