import Request from 'superagent';
const getApi = () => {
    let url = '/* URL */';
    return Request.get(url).then((res) => {
        this.setState({
             content: res.body
        });
    });
}
export default getApi;
I've created function in external file for api call. How do I get access to function/setState in external file?
componentWillMount(){
   getApi();
}
I receive this error:
'TypeError: Cannot read property 'setState' of undefined'
 
     
     
    