title: Good way to combine React and Leaflet
body: <p>I am working on a project to combine React and Leaflet, but I must say I am having some hard time with the semantics.</p>
  
  <p>As most of the stuff is managed by Leaflet directly, I don't know if it would make sense to add the Leaflet map instance as state in the React Component or not.</p>
  
  <p>Same problem when it comes to creating markers with Leaflet, as it does not return anything, I don't have anything to render really. The logic itself seems blurry to me.</p>
  
  <p>Here is what I started to make. It's working but I feel like I'm writing bad code and missing the concept.</p>
  
  <pre><code>/** @jsx React.DOM */
  
  /* DOING ALL THE REQUIRE */
  var Utils = require('../core/utils.js');
  
  var Livemap = React.createClass({
      uid: function() {
          var uid = 0;
          return function(){
              return uid++;
          };
      },
      getInitialState: function() {
          return {
              uid: this.uid()
          }
      },
      componentDidMount: function() {
          var map = L.map('map-' + this.state.uid, {
              minZoom: 2,
              maxZoom: 20,
              layers: [L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: '&amp;copy; &lt;a href="http://openstreetmap.org"&gt;OpenStreetMap&lt;/a&gt; contributors, &lt;a href="http://creativecommons.org/licenses/by-sa/2.0/"&gt;CC-BY-SA&lt;/a&gt;'})],
              attributionControl: false,
          });
          map.fitWorld();
          return this.setState({
              map: map
          });
      },
      render: function() {
          return (
              &lt;div className='map' id={'map-'+this.state.uid}&gt;&lt;/div&gt;
          );
      }
  });
  
  (function(){
      Utils.documentReady(function(){
          React.render(
              &lt;Livemap /&gt;,
              document.body
          )
      });
  })();
  </code></pre>
  
  <p>So my questions are:</p>
  
  <ul>
  <li>Does this sample seem legit?</li>
  <li>How would you approach the logic of adding markers and managing their events?</li>
  </ul>