class myInfo extends Component {
constructor(props) {
super(props);
this.state = {
name: sessionStorage.getItem('name'),
};
}
componentDidMount() {
axios.post('http://localhost:8080/allProfiles', {
"name": this.state.name
})
.then((response) => {
document.getElementById("email").innerHTML = "email: " + response.data.email;
})
.catch(function (error) {
console.log(error);
});
}
render() {
return (
<div>
<p id="email"></p>
</div>
);
}
}
Noob practising react here. Given the name my rest api would just return a json will all of its profile stuff like
{
"email": ...
"description: ...
}
For simplicity it will just get the email for now. The output of this page at the moment is
email: userFromThisSession@gmail.com
All in text. My goal is
Without the fancy css^^
So its the username for above image but same concept for email. I want
email: a textbox (has the email from above) (and then a button to edit it)
Anyone know how? I've been searching for a while but no luck