import React, { Component } from 'react';
import Loader from 'react-loader';
import Header from './Header';
import ImgurImageList from './ImgurImageList';
import { searchGallery } from './../services/imgur';

export default class App extends Component {

  constructor(props) {
    super(props);
    this.state = {images: [], page: 0, loaded: false};
  }

  loadImages(page = 0) {
    this.setState({loaded: false});
    searchGallery(undefined, undefined, page).then((result) => {
      this.setState({images: result.data, page: page, loaded: true});
    }).catch(() => {
      this.setState({loaded: true});
    });
  }

  componentDidMount() {
    this.loadImages();
  }

  render() {

    return (
      <Loader loaded={this.state.loaded}>
        <Header page={this.state.page} loadImages={this.loadImages.bind(this)} />
        <ImgurImageList images={this.state.images} />
      </Loader>
    );
  }
}

@@ -1,12 +1,42 @@
+import 'babel-core/register';%0A
 import React
@@ -381,16 +381,22 @@
 %0A  %7D%0A%0A  
+async 
 loadImag
@@ -406,24 +406,24 @@
 page = 0) %7B%0A
-
     this.set
@@ -446,20 +446,52 @@
 alse%7D);%0A
+%0A
     
+try %7B%0A      let result = await 
 searchGa
@@ -527,27 +527,9 @@
 age)
-.then((result) =%3E %7B
+;
 %0A   
@@ -604,21 +604,18 @@
    %7D
-).
+ 
 catch
-(() =%3E
+ (e)
  %7B%0A 
@@ -655,18 +655,17 @@
 );%0A    %7D
-);
+%0A
 %0A  %7D%0A%0A  

Replace the promise with async / await as its 10x cooler