title: Rendering part of a React function component after async call gets completed
body: <p>I'm using material-ui with a React function component and using its Autocomplete component. I customized it and whenever I change the text in input field, I expect the component to render new search result.</p>
  <pre><code>callAPI(&quot;xyz&quot;)
  </code></pre>
  <p>I'm calling the API in the action and using the xyz parameter, I'm calling the dispatch method from this function component.</p>
  <p>Problem here is, when the component makes the call, it is supposed to wait for the API response and then render the result, but it gets an unresolved promise, so it fails rendering.</p>
  <pre><code>&lt;Paper square&gt;
      {callAPI(&quot;xyz&quot;).results.map(
          result =&gt; console.log(result);
      )}
  &lt;/Paper&gt;
  </code></pre>
  <p>as results are a unresolved promise, it will fail to map.
  I need some way to call the map only once data is available, or show some text before data is there and then change once data is fetched.</p>
  <p>Any suggestions to correct this code will be very helpful.</p>
  <p>EDIT:</p>
  <pre><code>function IntegrationDownshift() {
      return (
          &lt;div&gt;
              &lt;Downshift id=&quot;downshift-simple&quot;&gt;
                  {({
                      getInputProps,
                      getItemProps,
                      getMenuProps,
                      highlightedIndex,
                      inputValue,
                      isOpen,
                      selectedItem
                  }) =&gt; (
                      &lt;div&gt;
                          {renderInput({
                              fullWidth: true,
                              InputProps: getInputProps({
                                  placeholder: &quot;Search users with id&quot;
                              })
                          })}
  
                          &lt;div {...getMenuProps()}&gt;
                              {isOpen ?
                                   &lt;Paper square&gt;
                                  {callAPI(inputValue).users.map(
                                      (suggestion, index) =&gt;
                                          renderSuggestion({
                                              suggestion,
                                              index,
                                              itemProps: getItemProps({
                                                  item:
                                                      suggestion.userName
                                              }),
                                              highlightedIndex,
                                              selectedItem
                                          })
                                  )}
                              &lt;/Paper&gt;  
                               : null}
                          &lt;/div&gt;
                      &lt;/div&gt;
                  )}
              &lt;/Downshift&gt;
          &lt;/div&gt;
      );
  }
  </code></pre>