Newsletter

Get more information about this, delivered straight to your inbox

import React, { useState } from ‘react’; function EmailList() { const [email, setEmail] = useState(”); const [emailList, setEmailList] = useState([]); const handleEmailChange = (event) => { setEmail(event.target.value); }; const addEmailToList = () => { // Add the email to the list and reset the input field setEmailList([…emailList, email]); setEmail(”); }; return (

Email List:

    {emailList.map((emailItem, index) => (
  • {emailItem}
  • ))}
); } export default EmailList;