We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`import React, { useState } from "react"; import "../Styles/Todos.css";
function Todos() { const [task, setTask] = useState(""); const [todos, setTodos] = useState([]);
let onInputEnter = (e) => { setTask(e.target.value); };
let onSubmitHandler = (e) => { e.preventDefault(); let newTodos = [...todos, task]; setTodos(newTodos); setTask(""); };
let deleteHandler = (indexValue) => { let newTodos = todos.filter((todo, index) => index !== indexValue); setTodos(newTodos); };
return (
<form onSubmit={() => onSubmitHandler()}> <input className="input-field" name="task" placeholder="Enter here..." value={task} onChange={() => onInputEnter()} /> <button className="btn" name="Add" type="submit"> Add </button> </form> {todos.map((todos, index) => { return ( <div key={index}> <h3> {todos} <button onClick={() => deleteHandler(index)}>delete</button>{" "} </h3> </div> ); })} </center> </div>
); }
export default Todos; `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
`import React, { useState } from "react";
import "../Styles/Todos.css";
function Todos() {
const [task, setTask] = useState("");
const [todos, setTodos] = useState([]);
let onInputEnter = (e) => {
setTask(e.target.value);
};
let onSubmitHandler = (e) => {
e.preventDefault();
let newTodos = [...todos, task];
setTodos(newTodos);
setTask("");
};
let deleteHandler = (indexValue) => {
let newTodos = todos.filter((todo, index) => index !== indexValue);
setTodos(newTodos);
};
return (
Todos Application using React js
);
}
export default Todos;
`
The text was updated successfully, but these errors were encountered: