title: .setState(): Filtering a person from an array of objects on button click
body: <p>In the code below, I am trying to remove a person from what will eventually be an org chart when the delete button next to their name is clicked. At the moment, nothing happens. The closest I've come is all 5 people being deleted when any one of the delete buttons is clicked, but I only want the one person deleted who's button is clicked. I feel like I'm making more of a JS error than a React error. </p>
  
  <p><a href="https://codesandbox.io/s/N9zG0kA56" rel="nofollow noreferrer">See the full code sandbox here.</a></p>
  
  <p>Any help would be appreciated, thank you! </p>
  
  <pre><code>    import React from "react";
  import { Component } from "react";
  
  const list = [
    {
      name: "Person 1",
      phone: "123-4567",
      itemId: 11
    },
    {
      name: "Person 2",
      phone: "123-4567",
      itemId: 12
    },
    {
      name: "Person 3",
      phone: "123-4567",
      itemId: 23
    },
    {
      name: "Person 4",
      phone: "123-4567",
      itemId: 34
    },
    {
      name: "Person 5",
      phone: "123-4567",
      itemId: 45
    }
  ];
  
  class Entry extends Component {
    constructor(props) {
      super(props);
  
      this.state = {
        list: list
      };
      this.handleClick = this.handleClick.bind(this);
    }
  
    handleClick(e) {
      this.setState({
        list: this.state.list.filter(function(person) {
          return person !== e.target.value;
        })
      });
    }
  
    render() {
      return (
        &lt;div&gt;
          {this.state.list.map(item =&gt;
            &lt;tr key={item.itemId}&gt;
              &lt;td&gt;
                {item.name}
              &lt;/td&gt;
              &lt;td&gt;
                {item.phone}
              &lt;/td&gt;
              &lt;td&gt;
                &lt;a className="delete" onClick={this.handleClick} /&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
          )}
        &lt;/div&gt;
      );
    }
  }
  
  export default Entry;
  </code></pre>