import './App.css'; import React from 'react'; import axios from 'axios'; import Contact from './components/contact.js' class App extends React.Component { state = { contacts: [] } getContacts = ()=>{ axios .get('https://desolate-thicket-29906.herokuapp.com/api/contacts') .then((response)=>{ this.setState({ contacts:response.data }) }) } componentDidMount = ()=>{ this.getContacts(); } createContact = (event)=>{ event.preventDefault(); axios .post( 'https://desolate-thicket-29906.herokuapp.com/api/contacts', { name:this.state.newContactName, age:this.state.newContactAge } ).then(()=>{ this.getContacts(); }) } changeNewContactName = (event)=>{ this.setState({ newContactName: event.target.value }) } changeNewContactAge = (event)=>{ this.setState({ newContactAge: event.target.value }) } render = ()=>{ return

Contacts App

List of Current Conacts

Create a new Contact

Name:
Age:
} } export default App;