title: using array.findIndex() on state in React
body: <p>So I am new to react and I need a bit of help. I am working on a form that takes in several values and am currently testing a function <code>assignAtribute</code>, which takes in the name of the input element and uses it to update the state of an array called <code>currentRecipe</code> (see below).</p>
  
  <pre><code> assignAttribute = (ident) =&gt; {
      var x = document.getElementById(ident).name;
      var holder = this.state.currentRecipe;
      var temp = null;
  
      var check = holder[x].findIndex(() =&gt; {return this.state[x]});
  
      check == -1 ? console.log('ok') : console.log('already exists')
  
      console.log(check)
  
      x == 'title' ?  temp = update(holder, {[x]: {$set: this.state[x] }}) 
      : x == 'ingredients' ? temp = update(holder, {[x]: {$push: [this.state[x]] }}) 
      : temp = update(holder, {[x]: {$push: [this.state[x]] }})
  
      holder = temp
      this.setState({ currentRecipe: holder})
      console.log(this.state[x])
      console.log(holder[x])
  
  }
  </code></pre>
  
  <p>I am having an issue with it:</p>
  
  <p>I want to filter the inputs so there are no duplicates so I am using a function inside that uses <code>array.findIndex()</code> to check it. When I look at the console output, I am not getting the output that matches the situation.</p>
  
  <p>Thanks in advance,</p>
  
  <p>Ben </p>