From 475d51c2a189cc2c8c5f58db1d473220f01437e9 Mon Sep 17 00:00:00 2001 From: Leon Xu Date: Sat, 7 May 2022 14:04:10 -0700 Subject: [PATCH] doc & fix: add setDisabled and setError to handleChange method and fix handleError to setError --- src/Checkout/Payment/Payment.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Checkout/Payment/Payment.js b/src/Checkout/Payment/Payment.js index 7a16886..5c9d463 100644 --- a/src/Checkout/Payment/Payment.js +++ b/src/Checkout/Payment/Payment.js @@ -10,11 +10,14 @@ function Payment() { const stripe = useStripe(); const elements = useElements(); - const [error, handleError] = useState(null); + const [error, setError] = useState(null); const [disabled, setDisabled] = useState(true); const handleSubmit = (e) => {}; - const handleChange = (e) => {}; + const handleChange = (e) => { + setDisabled(e.empty); + setError(e.error ? e.error.message : ""); + }; return (