title: Rendering GeoJSON with react-leaflet
body: <p>I've got simple component to pick point on map and then display some GeoJSON data related to this point:</p>
  
  <pre><code>import React, { Component } from 'react';
  
  import { Map, Marker, TileLayer, GeoJSON } from 'react-leaflet';
  import 'leaflet/dist/leaflet.css';
  
  import { connect } from 'react-redux';
  import './style.css';
  
  import { setPoint, fetchData } from '../../actions/map';
  
  @connect(store =&gt; {
    return {
      map: store.map
    }
  })
  class MyMap extends Component {
  
    mapClick(e) {
      this.props.dispatch(setPoint(e.latlng));
      this.props.dispatch(fetchData(e.latlng));
    }
  
    render() {
      const marker = () =&gt; {
        if(this.props.map.point) {
          return &lt;Marker position={this.props.map.point} /&gt;;
        }
      };
  
      const data = () =&gt; {
          if(this.props.map.data.length &gt; 0) {
              const json = this.props.map.data;
              return &lt;GeoJSON data={json} /&gt;
          }
      }
  
      return (
        &lt;div className='my-map'&gt;
          &lt;div className='my-map__map-container'&gt;
            &lt;Map center={this.props.map.center} zoom={13} onClick={this.mapClick.bind(this)}&gt;
              &lt;TileLayer url='http://{s}.tile.osm.org/{z}/{x}/{y}.png' attribution='&amp;copy; &lt;a href="http://osm.org/copyright"&gt;OpenStreetMap&lt;/a&gt; contributors' /&gt;
              {marker()}
              {data()}
            &lt;/Map&gt;
          &lt;/div&gt;
          &lt;div className='my-map__debug'&gt;
              {JSON.stringify(this.props.map)}
          &lt;/div&gt;
        &lt;/div&gt;
      );
    }
  }
  
  export default MyMap;
  </code></pre>
  
  <p>First time then I'm clicking on map marker appears and after some delay (XHR request) GeoJSON renders. But next time I'm clicking on map, I've got only changes in marker position, but old GeoJSON data remains on map. Debug part of component renders properly, and showing proper data. How can I force <code>react-leaflet</code> to re-render my GeoJSON data or maybe I'm doing something wrong?</p>
  
  <p><strong>UPD:</strong></p>
  
  <p>After asking author of <code>react-leafet</code> I've found how to reach expected behavior.</p>
  
  <p>To force react to re-render my GeoJSON data I need to pass some data-uniq key to component:</p>
  
  <pre><code>&lt;GeoJSON key={keyFunction(this.props.map.data.json)} data={this.props.map.data.json} /&gt;
  </code></pre>
  
  <p><a href="https://github.com/PaulLeCam/react-leaflet/issues/332#issuecomment-304228071" rel="noreferrer">https://github.com/PaulLeCam/react-leaflet/issues/332#issuecomment-304228071</a></p>