title: Undefined setState in React
body: <p>i tried to show data in a  using API in front but i got this error State in browser console and the data doesn't show up :</p>
  
  <p>Uncaught (in promise) TypeError: Cannot read property 'setState' of undefined
      at eval (tickets.jsx:190)</p>
  
  <p>This is  how i show data in render():</p>
  
  <pre><code>
   render(){
          var { items_tickets, dd_tickets, role, filter_tickets, all_tickets } = this.state;
          return(
   &lt;table className="table table-striped table-dark table-hover"&gt;
                     &lt;thead&gt;
                         &lt;tr&gt;
                              &lt;th&gt; N° de Ticket &lt;/th&gt; 
                              &lt;th&gt; Mes Gains  &lt;/th&gt; 
                              &lt;th&gt; (Non) utilisé  &lt;/th&gt; 
                         &lt;/tr&gt;
                     &lt;/thead&gt;
                     &lt;tbody&gt;
  {
  filter_tickets.length &gt; 0 ? filter_tickets.map(item =&gt; {
                                  console.log('filter tickets : ', filter_tickets)
                              const {numTicket, libelleGain, used} = item;
                              // console.log("items_tickets : ", items_tickets)
                              return  &lt;tr key={numTicket}&gt; 
                              &lt;td&gt;{numTicket}&lt;/td&gt;
                                  &lt;td&gt;{libelleGain}&lt;/td&gt;
                                  &lt;td&gt;{used === true ? "Utilisé" : "Non utilisé"}&lt;/td&gt;
                                      &lt;/tr&gt;
                              }) : "d"
                         } 
    &lt;/tbody&gt;
                  &lt;/table&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          )
      }
  </code></pre>
  
  <p>This is my API function in front : </p>
  
  <pre><code>    // Get all tickets 
      filterallTickets(){
          const head = localStorage.getItem('head'); 
          const payload = localStorage.getItem('payload');
          const signature = localStorage.getItem('signature');
          var tok = head + "." + payload + "." + signature;
   // Gains List
          fetch(`${API}/api/tickets/getalltickets`,{
  
              method: 'GET',
               headers :{
                  'Content-Type': 'application/json',
                  'authorization': `Bearer ${tok}`, } })
                  .then(results =&gt; {
                      return results.json();
                  })
                  .then(res =&gt; {
                          console.log("res : ",res);
                      if(res.success === true){
                          this.setState({ filter_tickets: res.result });
                          // this.setState({items_tickets: []});
                      }
                  })
      }
  </code></pre>
  
  <p>Thank you</p>