title: My fetch command doesn't work, what did i do wrong?
body: <p><a href="https://i.stack.imgur.com/EWSvW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EWSvW.png" alt="enter image description here" /></a>im trying to fetch customers and trainings by using a fetch request but for some reason it doesn´t print anything in the page. However it is printing those informations in the network console.</p>
  <pre><code>import React, { useState, useEffect } from &quot;react&quot;;
  import Snackbar from '@material-ui/core/Snackbar';
  import Addcustomer from &quot;./Addcustomer&quot;;
  import Addtraining from &quot;./Addtraining&quot;;
  import Editcustomer from &quot;./Editcustomer&quot;;
  import { AgGridReact } from'ag-grid-react'
  import'ag-grid-community/dist/styles/ag-grid.css'
  import'ag-grid-community/dist/styles/ag-theme-material.css';
  
  export default function Customerlist() {
     const [customers, setCustomers] = useState([]);
  
     useEffect(() =&gt; fetchData(), []);
  
     const fetchData = () =&gt; {
         fetch('https://customerrest.herokuapp.com/api/customers')
             .then(response =&gt; response.json())
             .then(data =&gt; setCustomers(data.content));
     };
  
     const deleteCustomer = link =&gt; {
         if (window.confirm(&quot;Are you sure to delete customer?&quot;)) {
             console.log(link);
             fetch(link, { method: &quot;DELETE&quot; })
                 .then(res =&gt; {
  
                     fetchData();
                     if (res.status &gt;= 200 &amp;&amp; res.status &lt; 300) {
                         Snackbar({ message: &quot;Customer deleted successfully&quot; });
                     } else {
                         Snackbar({ message: &quot;Error. Try again.&quot; });
                     }
                 })
                     .catch(err =&gt; console.error(err));
         }
     };
  
     const saveCustomer = customer =&gt; {
         fetch('https://customerrest.herokuapp.com/api/customers', {
             method: &quot;POST&quot;,
             headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
             body: JSON.stringify(customer)
         })
             .then(res =&gt; {
                 fetchData();
                 if (res.status &gt;= 200 &amp;&amp; res.status &lt; 300) {
                     Snackbar({ message: &quot;Customer added successfully&quot; });
                 } else {
                     Snackbar({ message: &quot;Error. Try again.&quot; });
                 }
             })
                 .catch(err =&gt; console.error(err));
     };
  
         const saveTraining = training =&gt; {
         fetch('https://customerrest.herokuapp.com/api/trainings', {
             method: &quot;POST&quot;,
             headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
             body: JSON.stringify(training)
         })
  
         .then(res =&gt; {
             fetchData();
             if (res.status &gt;= 200 &amp;&amp; res.status &lt; 300) {
                 Snackbar({ message: &quot;Training added successfully&quot; });
                 } else {
                 Snackbar({ message: &quot;Error. Try again.&quot; });
                 }
             })
             .catch(err =&gt; console.error(err));
     };
  
         const updateCustomer = (customer, link) =&gt; {
         fetch(link, {
             method: &quot;PUT&quot;,
             headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
             body: JSON.stringify(customer)
         })
             .then(res =&gt; fetchData())
             .then(Snackbar({ message: &quot;Customer updated successfully&quot; }))
             .catch(err =&gt; console.error(err));
     };
  
     const columns = [
         
         {
             title: &quot;Edit&quot;,
             field: &quot;links[0].href&quot;,
             render: customerData =&gt; (
             &lt;Editcustomer updateCustomer={updateCustomer} customer={customerData} /&gt;
             ),
             sorting: false
         },
         {
             Header: &quot;First name&quot;,
             accessor: &quot;firstname&quot;
         },
         {
             Header: &quot;Last name&quot;,
             accessor: &quot;lastname&quot;
         },
         {
             Header: &quot;Email&quot;,
             accessor: &quot;email&quot;
         },
         {
             Header: &quot;Phone&quot;,
             accessor: &quot;phone&quot;
         },
         {
             Header: &quot;Address&quot;,
             accessor: &quot;streetaddress&quot;
         },
         {
             Header: &quot;Postcode&quot;,
             accessor: &quot;postcode&quot;
         },
         {
             Header: &quot;City&quot;,
             accessor: &quot;city&quot;
         },
   {
             title: &quot;Delete&quot;,
             field: &quot;links[0].href&quot;,
             render: customerData =&gt; (
             
             &lt;button
             style={{ cursor: &quot;pointer&quot; }}
             onClick={() =&gt; deleteCustomer(customerData.links[0].href)}
             &gt;Delete&lt;/button&gt;
         ),
             sorting: false
     },
         {
             title: &quot;Add training&quot;,
             render: trainingRow =&gt; (
             &lt;Addtraining
                 saveTraining={saveTraining}
                 customerId={trainingRow.links[0].href}
                 /&gt;
             ),
                 sorting: false
         }
     ];
  
     return (
         &lt;div&gt;
             
             &lt;Addcustomer saveCustomer={saveCustomer} /&gt;
             &lt;AgGridReact
                 title=&quot;Customers&quot;
                 rowData={customers}
                 columns={columns}
                 options={{ sorting: true }}
             &gt;&lt;/AgGridReact&gt;
         &lt;/div&gt;
     );
  }
  </code></pre>
  <p>i have multiple fetch requests for training and customers but its not working
  it shows the information in the console but it doesn't show them in the page. I would like to see all the information in my page, so what i have to do or what did i do wrong here?</p>