title: React - check if a object is in state variable
body: <p>I have a state variable that is a object (called testObject). I store several objects in that state variable. Iam looking for a way to check if a object already exists in that state variable then remove it if true.</p>
  
  <p>so to sum up the dilemma:</p>
  
  <ul>
  <li>check if a object is already in testObject</li>
  <li>If true => delete that object</li>
  <li><p>if false => add the object to testObject</p>
  
  <p>class Connector extends Component {</p>
  
  <pre><code>constructor(props) {
      super(props);
      this.state=({
          testObject: {},
      });
  
      console.log(this.props);
  }
  </code></pre>
  
  <p>}</p></li>
  </ul>