title: How to clear leaflet layer after click
body: <p>I try to select/deselect the layer using a mouse click. Firstly my map is in this way</p>
  
  <p><a href="https://i.stack.imgur.com/lOI95.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lOI95.png" alt=""></a> </p>
  
  <p>After clicking on a layer I want to select it and highlight</p>
  
  <p><a href="https://i.stack.imgur.com/63Rx2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/63Rx2.png" alt=""></a></p>
  
  <p>Now if I click again on the previously selected layer, I want to deselect it and reset the highlight. This is the code that I use to do this:</p>
  
  <pre><code>  onEachFeature: function(feature,layer) {
  
        layer.setStyle({fillOpacity: 0.0 , color: '#424a44', weight: 2});
        layer.on('click', function(e) {
  
        let isLayerAlreadySelected =  // Some logic to undestand if layer alreeady selected
  
        if(isLayerAlreadySelected) 
           layer.setStyle({fillOpacity: 0.0 , color: '#424a44', weight: 2});
        else
            layer.setStyle({fillOpacity: 0.4 , color: '#004691', weight: 3});
        }
  
    }
  </code></pre>
  
  <p>But sometimes when I try to deselect previously selected layer, the layer style is not resetting the opacity remains. Some suggestions about this? </p>