title: How to pass the data from one js file to another react.js file
body: <p>I want to pass the data from one js file to another js file here is my code:<strong>(react.js)</strong></p>
  
  <pre><code>&lt;script type="text/jsx"&gt;
  /** @jsx React.DOM */
  var APP=
  React.createClass({
      getInitialState:function(){
          return{
              result:[]
          };
      },
      componentDidMount: function() {
          alert("DidMount");
          var data = getData();
              alert("final")
      },
          render: function () {
          alert("render");
               return(
                  &lt;table className="table table-bordered"&gt;
                  &lt;tr&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;Class&lt;/th&gt;
                  &lt;th&gt;D.O.B&lt;/th&gt;
                  &lt;/tr&gt;
          &lt;/table&gt;
  )
          }
      })
  React.renderComponent(
          &lt;APP/&gt;,
          document.getElementById('root'));
  </code></pre>
  
  <p></p>
  
  <p>and my js file is :</p>
  
  <pre><code>    getData1=function() {
      alert("initial")
      var Connection = require('tedious').Connection;
      var  Request = require('tedious').Request;
      var config = {
          userName: 'zxzx',
          password: '******',
          server: 'xxxxxxx',// You can use 'localhost\\instance' to connect to named instance
          options: {
              database: 'xxxx',
              rowCollectionOnRequestCompletion: true,
              useColumnNames : true
          }
      };
      var connection = new Connection(config);
      connection.on('connect', function (err) {
          if (err) {
              console.log(err)
          }
          request = new Request("SELECT * FROM XXXXX", function (err, rowCount, rows) {
              if (err) {
                  //console.log(err);
                  callback(err, null);
              } else {
                  console.log(+'rows Count: ' + rowCount);
                  console.log(JSON.stringify(rows));
                  var datas = JSON.stringify(rows);
                  alert(datas)
                  alert("rows")
                  return datas;
              }
              connection.close();
          });
          connection.execSql(request);
      });
  }
  </code></pre>
  
  <p>what i want is that i need to return the data when calling the function in react, what happening here is that in my console it shows the data, but in react the data is coming as empty, i.e the data is not returned correctly. Can any one give solution for it?</p>