Created
December 19, 2016 00:21
-
-
Save odirleiborgert/c502905c676ff378b25c9af192943fec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Container, Divider, Card, Icon } from 'semantic-ui-react'; | |
import axios from 'axios'; | |
import SearchCar from './../services/SearchCar'; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
title: 'List cars', | |
cars: [] | |
} | |
} | |
render(){ | |
var cars = []; | |
cars = SearchCar.getByTerm() | |
.then(function(response){ | |
return response.data; | |
}) | |
.catch(function(response){ | |
console.log('erro'); | |
}); | |
const carList = cars.map(function(car){ | |
return ( | |
<div> | |
{car.id} - {car.model} | |
</div> | |
); | |
}); | |
return ( | |
<Container fluid> | |
<h1>olá React {this.state.title}</h1> | |
<Divider /> | |
{carList} | |
</Container> | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment