doc & fix: add setDisabled and setError to handleChange method and fix handleError to setError

This commit is contained in:
Leon Xu committed 2022-05-07 14:04:10 -07:00
1 parent 5ac0d48ec7
commit 475d51c2a1
1 file changed
+5 -2
+5 -2
View File
@@ -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 (
<section className="payment">