score:2

Accepted answer

rewrite your function in file like this:

    export function getcalendarevents( callback ) {
      ...

      // handle the response from our api call
      request.execute((resp) => {
        ...
        callback( resp )
      };

    });

    import {getcalendarevents} from './googlecalendarevents';

    componentwillmount(){
      var myitems = getcalendarevents( (resp) => {
        console.log(resp)
      }); 
    }

Related Query

More Query from same tag