Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
¿Cómo puedo eliminar un elemento de la lista de tareas pendientes?

Estoy codificando una lista de tareas simples. Eliminar elementos no funciona haciendo clic en él. ¿Qué puede estar mal? ¿La matriz de filtrado y el estado de configuración son correctos?

 import React from "react"; import { useState } from "react"; export const ToDoComponent = () => { const inputResult = { id: Date.now(), value: "", }; const [value, setValue] = useState([]); const onChange = (event) => { inputResult.value = event.target.value; }; const addTask = (event) => { setValue([{ inputResult }, ...value]); }; const delTask = (id) => { const res = value.filter((delId) => id !== delId.id); setValue(res); // console.log("test") }; return ( <div> <h1 className="Title">Todo list</h1> <input onChange={onChange} className="Input"></input> <button className="Button" onClick={addTask}> Add task </button> <ul> {value.map(({ inputResult }) => ( <li onClick = {delTask(inputResult.id)} key={inputResult.id}> {inputResult.value} </li> ))} </ul> </div> ); };
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!