import axios from "axios"; import { toast } from "react-toastify"; import { useState } from "react"; const MailingList = () => { const [mail, setMail] = useState(null); const [loading, setLoading] = useState(false); const subscribe = () => { setLoading(true); axios .put("api/mailingList", { mail, }) .then((result) => { if (result.status === 200) { toast.success(result.data.message); setLoading(false); } }) .catch((err) => { console.log(err); setLoading(false); }); }; return (