I'm currently using functions to predefine all of my axios calls so for example:
export const getClients = () => {
    axios.get("/client/")
        .then(response=>{
            return response;
        })
        .catch(error=>{
            return error;
        });
    };
Now, I want to call this in a class-based component in the componentDidMount like this:
  componentDidMount(){
        this.setState({
            clients: getClients()
        });
  }
I can't seem to figure out why when I try to console.log(this.state.clients) at the end of componentDidMount I'm getting an undefined error. I'm new to React and from what I understand, the then in the function of the axios call should resolve the promise and return the actual response from the API call so when I call getClients(), the clients state should be the response.
What am I doing wrong?
 
     
    