title: ReactJS How to prevent multiple API calls occurring in componentDidMount function
body: <p>I have the following axios request given inside <code>componentDidMount</code> function and when I inspect the network I found API called 6 times. What will be the reason for this much calls triggered and is there any other function or solutions to solve this?</p>
  
  <pre><code>componentDidMount(){
       axios.get(this.state.url+'tables', { headers: { 'authorization': token } })
       .then(response =&gt; { 
           const regions = response.data.data.regions,
                  state = response.data.data.state,
                  directory = response.data.data.directory,
  
           this.setState({ regions,state,directory });
       })
       .catch((error) =&gt; {
           console.log('error ' + error);
        });
  
  }
  </code></pre>