import React from 'react';
import $ from 'jquery';

class Pages extends React.Component {

  constructor(props) {
    super(props);

    this.state = {
      pages: []
    };
  }

  componentDidMount() {
    this.serverRequest = $.get('/api/pages', function (response) {
      let data = response.result;
      this.setState({
        pages: data
      });
    }.bind(this));
  }

  componentWillUnmount() {
    this.serverRequest.abort();
  }

  render() {
    console.log(this.state);
    return (
      <div>
        <h4>Your Pages</h4>
        {this.state.pages.map(function (page, i) {
          return (
            <div>
              <a index={i}
                href={'/page/' + page.nameslug}
              >
              {page.name}
              </a>
            </div>
          );
        })}
      </div>
    );
  }
}

export default Pages;

@@ -245,17 +245,8 @@
 es',
- function
  (re
@@ -252,16 +252,19 @@
 esponse)
+ =%3E
  %7B%0A     
@@ -353,19 +353,8 @@
    %7D
-.bind(this)
 );%0A 
@@ -421,16 +421,16 @@
 );%0A  %7D%0A%0A
+
   render
@@ -438,37 +438,8 @@
 ) %7B%0A
-    console.log(this.state);%0A
     

use arrow function