title: Function render after splice and setState()
body: <p>I want my React function to re-render after I splice an array.</p>
  
  <p>Here Is (part of) the function (using Hooks):</p>
  
  <pre><code>function showProblem() {
    const [andArray, setAndArray] = useState([]);
  
  const deleteTag = (i, arr) =&gt; {
      let and = andArray;
      switch (arr) {
        case "and":
          and.splice(i, 1);
          setAndArray(and);
          break;
        default:
          return null;
      }
    };
  
  
  return(
  &lt;div&gt;
      {andArray.map((and, i) =&gt; {
              return (
                &lt;span
                  onClick={() =&gt; deleteTag(i, "and")}
                  key={i}
                &gt;
                  {and}
                &lt;/span&gt;
              );
       })}
  &lt;/div&gt;
  )
  }
  
  </code></pre>
  
  <p>When I click on the SPAN element, I want my "andArray.map" to render again.</p>
  
  <p>The splice is working correctly, my array is ok... but the function does not re-render.</p>
  
  <p>Thanks a lot.</p>