title: how can I delete the element in react js
body: <p>I want to create simple application with react js, which should show the users in the display and then when I click on the delete button, it should delete the following item, however I am having some errors.</p>
  <pre><code>import React, { useEffect, useState } from 'react'
  const App = () =&gt; {
    const [users, setUsers] = useState([])
  
    useEffect(() =&gt; {
      fetch(&quot;https://jsonplaceholder.typicode.com/users&quot;)
        .then((response) =&gt; response.json())
        .then((users) =&gt; {
          setUsers(users);
        })
    }, [users]);
  
    const deleteMe = () =&gt; {
      setUsers(prevState =&gt; {
        return prevState.filter(e =&gt; e.name)
      })
    }
  
    return (
      &lt;&gt;
        {users.map((user) =&gt; {
          return (
            &lt;&gt;
              &lt;div&gt; {user.name}
                &lt;button onClick={deleteMe}&gt; Delete &lt;/button&gt;
                {/* &lt;button onClick={}&gt; Update &lt;/button&gt; */}
              &lt;/div&gt;
            &lt;/&gt;
          )
        })}
      &lt;/&gt;
    )
  }
  
  export default App
  </code></pre>