title: Remove an item from local storage in reactjs
body: <h3>Is this the right code to remove an item from <em>localStorage</em>:</h3>
  <pre><code>onDelete(name) {
          console.log(&quot;ProductList.onDelete: &quot;, name);
          let {products} = this.state;
          products = products.filter(product =&gt; product.name !== name);
          this.setState({products});
          localStorage.setItem('products', JSON.stringify(products));
  }
  </code></pre>