title: How to force re render when an array changes its value in ReactJS
body: <p>How to force re-render when an array changes its value in ReactJS.</p>
  <p>I have an array like</p>
  <pre class="lang-js prettyprint-override"><code>const [providers, setProviders] = useState&lt;Array&lt;any&gt;&gt;(props.filters?.providers!);
  </code></pre>
  <p>and when I call a delete function to remove one element of this array the view doesn't render.</p>
  <pre class="lang-js prettyprint-override"><code>let OnDelete = (prop: any, func: any, p: IFilter) =&gt; {
      const index = prop.findIndex((x: IFilter) =&gt; x.code == p.code);
      if (index !== -1) {
          prop.splice(index, 1);
      }
      func(prop);
  };
  </code></pre>