feat(Newsletter.tsx): add possibilidade de limpar input após clique no botão Enviar

This commit is contained in:
Ana Carolina Duarte Cavalcante 2023-01-11 09:49:15 -03:00
parent 6b6488a911
commit ca1d07f561

View File

@ -1,6 +1,8 @@
import styles from "./Footer.module.scss";
import React from "react";
const Newsletter = () => {
const [result, setResult] = React.useState('');
return (
<div className={styles["Newsletter__Content"]}>
<div className={styles["Newsletter__Content__Block"]}>
@ -8,8 +10,8 @@ const Newsletter = () => {
Assine nossa Newsletter
</h3>
<div className={styles["Newsletter__Content__Block__Register"]}>
<input type="text" placeholder="E-mail" />
<button>Enviar</button>
<input type="text" placeholder="E-mail" onChange={(e) => setResult(e.target.value)} value={result} />
<button onClick={() => setResult('')}>Enviar</button>
</div>
</div>
</div>