title: React array map ,how to get only 2 objects from array.map
body: <pre><code>class App extends React.Component {
    constructor() {
      super();
      this.state = {items: []}
    }
    componentWillMount() {
      fetch('https://swapi.co/api/people/?format=json')
        .then(response =&gt; response.json())
        .then(({results: items}) =&gt; this.setState({items}))
    }
    render() {
      let items = this.state.items
      return (
        &lt;div&gt;
  
        &lt;ul&gt;
        {items.map((item) =&gt;
          &lt;li key={item.id}&gt;
            {item.name}
          &lt;/li&gt;
  
        )}
      &lt;/ul&gt;
  
  
        &lt;/div&gt;
      )
    }
  }
  
  ReactDOM.render(
    &lt;App /&gt;,
    document.getElementById('container')
  );
  </code></pre>
  
  <ul>
  <li><p>Here the Array.map render all the properties from object.</p>
  
  <p>I want only 2 objects using array.map method and render only 2 objects, not all</p>
  
  <p>how can I do this ?</p>
  
  <p>Regards,</p></li>
  </ul>