title: Sending a String from Node Js to a component React Js
body: <p>i am using Node Js and React Js to send data from node to a React component but the state never change in the console when i did response.json() i get my string sent but in my component it's empty and there is no data .
  Here is my Node js code  : </p>
  
  <pre><code>app.post('/try', function(req, res) {
    results='hello everybody !'
    res.send(JSON.stringify(results));
  }); 
  </code></pre>
  
  <p>And here's my React component:</p>
  
  <pre><code>import React, { Component } from 'react';
  
  class App extends Component {
    constructor(props) {
      super(props);
      this.state = { results: null };
    }
  
  
    componentDidMount() {
      const data = new FormData();
  
      fetch('http://localhost:4000/try',{
  
        method: 'POST',
        body : data
      })
        .then(
          (response) =&gt; {
            console.log(response);
            return response.json();
  
          } // if the response is a JSON object
        ).then(
        success =&gt;console.log(success) // Handle the success response object
      ).catch(
        error =&gt; null // Handle the error response object
      )
        .then(results =&gt; {
            this.setState({ results: results });
            console.log(results)
  
        });
    }
    render() {
      return (
        &lt;div className="Users"&gt;
        &lt;h1&gt;results&lt;/h1&gt;
        &lt;div&gt;this is my result: {this.state.results}&lt;/div&gt;
      &lt;/div&gt;
    );
    }
  }
  
  export default App;
  </code></pre>