title: How can I call methods on Reactjs components in the browser console or from an outside script?
body: <p>I am creating a leaflet map component, here is an example on plunker </p>
  
  <p><a href="http://plnkr.co/edit/LkghwOcby49XESdGb782?p=preview">http://plnkr.co/edit/LkghwOcby49XESdGb782?p=preview</a></p>
  
  <p>here is the code </p>
  
  <p>leaflet.jsx</p>
  
  <pre><code>/** @jsx React.DOM */
  /*jshint indent: 2, node: true, nomen: true, browser: true*/
  /*global React */
  
  'use strict';
  module.exports = React.createClass({
    getInitialState: function () {
      return {
        map: {}
      };
    },
    componentDidMount: function() {
      var map = L.map('map').setView([51.505, -0.09], 13);
      L.tileLayer('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'
      }).addTo(map);
      this.setState({map: map});
    },
    modifyMap: function (method, options) {
      this.setState({
        map : this.state.map[method](options.latLong, options.zoom, options.zoom_options)
      });
    },
    render: function () {
      return (
        /* jshint ignore:start */
        &lt;div id="map"&gt;&lt;/div&gt;
        /* jshint ignore:end */
      );
    }
  });
  </code></pre>
  
  <p>map.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;!--[if lt IE 7]&gt;      &lt;html class="no-js lt-ie9 lt-ie8 lt-ie7"&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 7]&gt;         &lt;html class="no-js lt-ie9 lt-ie8"&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 8]&gt;         &lt;html class="no-js lt-ie9"&gt; &lt;![endif]--&gt;
  &lt;!--[if gt IE 8]&gt;&lt;!--&gt; &lt;html class="no-js"&gt; &lt;!--&lt;![endif]--&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;title&gt;Leafy&lt;/title&gt;
      &lt;meta name="description" content=""&gt;
      &lt;meta name="viewport" content="width=device-width"&gt;
      &lt;!-- Place favicon.ico and apple-touch-icon.png in the root directory --&gt;
      &lt;!-- build:css(.tmp) styles/main.css --&gt;
      &lt;style&gt;
        #map {
          height: 200px;
        }
      &lt;/style&gt;
      &lt;link rel="stylesheet" href="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"&gt;
      &lt;!-- endbuild --&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;!--[if lt IE 9]&gt;
        &lt;p class="browsehappy"&gt;You are using an &lt;strong&gt;outdated&lt;/strong&gt; browser. Please &lt;a href="http://browsehappy.com/"&gt;upgrade your browser&lt;/a&gt; to improve your experience.&lt;/p&gt;
      &lt;![endif]--&gt;
  
      &lt;div class="container"&gt;
        &lt;div id="leaflet"&gt;&lt;/div&gt;
      &lt;/div&gt;
  
      &lt;!-- build:js scripts/vendor.js --&gt;
      &lt;script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;script src="//cdnjs.cloudflare.com/ajax/libs/react/0.11.0/react-with-addons.min.js"&gt;&lt;/script&gt;
      &lt;script src="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"&gt;&lt;/script&gt;
      &lt;!-- endbuild --&gt;
  
      &lt;!-- build:js scripts/main.js --&gt;
      &lt;script src="leaflet.jsx"&gt;&lt;/script&gt;
      &lt;!-- endbuild --&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I would like to try and call the modifyMap method directly from the browser console or from any script on the page. I have tried to use statics but I am unable to find the Object which contains the modifyMap method. Is there an easy way to find this method or is there a better way of doing this with Reactjs? I also know that this is possible if the React class was created on this page instead of using module.exports in a separate file, I am hoping there is another way! Please help!</p>