title: How to update React localstorage?
body: <p>I have a website that does one of two things. If you have never been to the site, it asks for info, which is stored in localstorage, and then it takes you to the main content. If you have filled out the info before, then it takes you straight to the main content. This is all done in one page. </p>
  
  <p>Currently, my main content page only works upon page reload. This is because React does not have localstorage data to load the main content. It is only rendering the page on load. As stated, this is all to happen on the same page.      </p>
  
  <pre><code>&lt;script type="text/babel"&gt;
  var Weatherapp = React.createClass({
  
  render: function(){
  var weatherplace = localStorage.getItem('yourlocation');
  var weatherplaceshared = localStorage.getItem('yourlocation').replace(/,/g, ", ");
  var weathervane = new XMLHttpRequest();
  weathervane.open('GET', 'http://api.openweathermap.org/data/2.5/weather?q='+weatherplace+'&amp;appid=stuff', false);
  weathervane.send(null);
  var runthru = JSON.parse(weathervane.response);
  var weathervalue = runthru.main.temp;
  var weatherimage = runthru.weather[0].icon;
  var weatherimageplace = "http://openweathermap.org/img/w/"+weatherimage+".png";
  return (
  &lt;div id="weatherapp_container"&gt;
  
  &lt;div id="weatherapp_location"&gt;{weatherplaceshared}&lt;/div&gt;
  &lt;div id="weatherapp_icon"&gt;&lt;img src={weatherimageplace}/&gt;&lt;/div&gt;
  &lt;div id="weatherapp_temperature"&gt;&lt;p&gt;{weathervalue}&amp;deg;F&lt;/p&gt;&lt;/div&gt;
  
  
  &lt;/div&gt;
  )}
  
  });
  
  ReactDOM.render(&lt;Weatherapp /&gt;, document.getElementById('weatherapp'));
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to restart the render function on a click event. To that end, I have changed my code like so. Note, the <code>submitsuestado</code> is the button that activates my function once input is stored for the first time. </p>
  
  <pre><code>render: function(){
  document.getElementById('submitsuestado').addEventListener('click', function(){
  var yourcity = document.getElementById('suciudad').value;
  var yourstate = document.getElementById('suestate').value;
  localStorage.setItem('yourlocation', yourcity+","+yourstate);
  </code></pre>
  
  <p>From there I duplicate the rest of the code on top. However, this does not work. I am trying to understand where the error lies, and what I might do to make sure that <code>Weatherapp</code> runs both on page load with local storage data stored, as well as on a fresh page where the local storage data is just recently put.  </p>