I am using React and have built an email form. I currently have this class: <div className="msg">Message has been sent</div>
but only want it to appear when the message has successfully sent. So only when the following resolves as status: true. How can I target this using only React/CSS?
.post('/api/email', values)
.then((res) => {
console.log("Server responded")
setValues({
name: "",
email: "",
message: "",
status: true
})
.catch(err => {
console.log(err);
window.alert("Email not sent")
});```