title: The response from API is not rendering first time in react JS
body: <p>I am fetching response from API and i get array of objects from response and I am trying to render data from each objects. but in first render it is not rendering but when i enter any input or interchange between the components then it is visible. Please help me to resolve the issue.</p>
  <pre><code>const printList = () =&gt; {
  
          return(
              &lt;div&gt;
                  {
                      array.map((data)=&gt;
                          &lt;div className=&quot;row&quot; key={data.id} &gt;
                              &lt;div className=&quot;col-4&quot; &gt;{data.workshop.name}&lt;/div&gt;
                              &lt;div className=&quot;col-4&quot; &gt;{data.campaignId}&lt;/div&gt;
                              &lt;div className=&quot;col-4&quot; &gt;
                              &lt;button &gt;RESCHEDULE&lt;/button&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      )
                  }
              &lt;/div&gt;
          )
          
      }
  </code></pre>
  <p>the below is the api fetch</p>
  <pre><code>const data = await response.json();
          console.log(data.data);
          if(data.data!=undefined){
              for(let i=0;i&lt;data.data.length;i++){
                  arr.push(data.data[i]);
                  setArray(arr);
              }
          }
  </code></pre>