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

183
Views
En reaccionar, tampoco se pueden mostrar valores de estado

Quiero hacer una tabla para las listas de correo electrónico de los usuarios. pero cuando creo un nuevo correo electrónico (haga clic en Agregar usuario btn), el estado de users no se actualiza. ¿podrían ayudarme a solucionar este problema? gracias

 import React, {useState} from 'react'; const Admin: NextPage = () => { const [users, setUsers] = useState([ { email: "xxx@test.com" }, { email: "bbb@test.com"}, ]); const [email, setEmail] = useState(''); const removeUser = rowEmail => { const updatedArray = users.filter((row) => row.email !== rowEmail); setUsers(updatedArray); } const addUser = () => { console.log(email); const lists = users; lists.push({'email' : email}); setUsers(lists); } return ( <> <div className="user-user"> <input type="email" onChange={event => setEmail(event.target.value)} /> <span onClick={() => addUser()}>Add User</span> </div> <div className="user-list"> <table> <thead> <tr> <th>Users</th> <th>Action</th> </tr> </thead> <tbody> {users.map((val, key) => { return ( <tr key={key}> <td>{val.email}</td> <td><span onClick={() => removeUser(val.email)}>Remove</span></td> </tr> ) })} </tbody> </table> </div> </> ); } export default Admin;
about 4 years ago · Santiago Gelvez
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!