title: how to work with json in react.js
body: <p>Here data in json : <a href="https://jsonplaceholder.typicode.com/posts" rel="nofollow noreferrer">https://jsonplaceholder.typicode.com/posts</a></p>
  
  <p>Here my code. After running it i got error in console.log: "Objects are not valid as a React child (found: object with keys {userId, id, title, body}). If you meant to render a collection of children".
  Why when i console.log(response) inside COmpoonentDidMount i have my array of objects but can't use it inside render() {}. What im doing wrong? </p>
  
  <pre><code>class App extends React.Component {
      constructor(props) {
          super(props);
          this.state = { 
              users: []
          }
      }
  
    componentDidMount() {  
        var component = this;
        api.fetchInfo() 
          .then(function(response) {
              component.setState( { users: response } );
          });
    }
  
    render() { 
      //console.log('here' + this.state.users);
      return (
        &lt;ul&gt;
  
          &lt;p&gt;{this.state.users}&lt;/p&gt;
          {
              this.state.users.map(
                  function(elem) {
                     return &lt;li&gt;{elem.userId}&lt;/li&gt; 
                  }
              )
          }
        &lt;/ul&gt;
      )
    }
  }
  
  
  ReactDOM.render(
    &lt;App /&gt;,
    document.getElementById('app')
  );
  </code></pre>