Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import Image from './Image';
  3. var axios = require('axios');
  4.  
  5. export default class ImageList extends Component {
  6.  
  7.   getImage = () => {
  8.     axios.get("https://crossorigin.me/http://xkcd.com/1/info.0.json").then(function(reponse){
  9.         this.setState({
  10.           object: reponse.data
  11.         });
  12.         console.log(reponse.data);
  13.     });
  14.   }
  15.  
  16.   componentDidMount(){
  17.     getImage()
  18.   }
  19.  
  20.   render() {
  21.     return (
  22.       <div className="gallery">
  23.         <div className="images">
  24.           <Image key={this.state.object.num} id={this.state.object.num} path={this.state.object.url} />
  25.           /*{this.props.imageUrls.map((object) => <Image key={object.id} id={object.id} path={object.url}/>)}*/
  26.         </div>
  27.       </div>
  28.     );
  29.   }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement