title: Get updated data from database with reactjs, axios and php
body: <p>I want to get the latest data from a database and render it to my page.
  When i load the page for the first time it works fine, but when i change data in the db nothing changes on the page. Even when i call the update function it does not change anything.</p>
  <p>The page im posting to has a php function which retrieves data from the db (mysql).</p>
  <p>If im doing something wrong, what would be my best option for this?</p>
  <pre><code>class Car extends React.Component {
    constructor(props) {
    super(props);
    this.state = {resultState: &quot;red&quot;};
    };
    componentDidMount() {
      axios.post(`https://web.site/page.php`)
      .then(res =&gt; {
        console.log(res.data);
        this.setState({ resultState: res.data });
      });
    }
    
    update() {
      this.forceUpdate();
    };
    render() {
      return (&lt;div&gt;
          &lt;div className=&quot;row&quot; dangerouslySetInnerHTML={{__html: this.state.resultState}}&gt;&lt;/div&gt;
          &lt;/div&gt;)
    }
  }
  ReactDOM.render(&lt;Car /&gt;, document.getElementById('mydiv'))
  </code></pre>