forked from M3-Academy/desafio-react-e-typescript
feat(Newsletter.tsx): add possibilidade de limpar input após clique no botão Enviar
This commit is contained in:
parent
6b6488a911
commit
ca1d07f561
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user