Created
September 10, 2018 18:59
-
-
Save jmercedes/7201df687af58c413dddfef867448910 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, { Component } from 'react' | |
class PatientProfile extends Component { | |
state = { | |
paciente: {} | |
} | |
componentDidMount(){ | |
fetch('https://jsonplaceholder.typicode.com/posts?userId=1') | |
.then( (res) => res.json() ) | |
.then( (data) => { | |
this.setState({ paciente: data | |
}) | |
}) | |
} | |
render(){ | |
const { paciente } = this.state | |
console.log(this.state.paciente) | |
return ( | |
<div> | |
<h1>Perfil</h1> | |
<h1>{paciente.title}</h1> | |
</div> | |
) | |
} | |
} | |
export default PatientProfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment