doc: add CardElement, useElements, useStripe from react-stripe-js and handleChange and handleSubmit method

This commit is contained in:
Leon Xu committed 2022-05-07 14:02:02 -07:00
1 parent f2ebe6e580
commit 7b96e90ea8
1 file changed
+12 -1
+12 -1
View File
@@ -3,9 +3,16 @@ import { useStateValue } from "../../redux/StateProvider";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import CheckoutProduct from "../CheckoutProduct"; import CheckoutProduct from "../CheckoutProduct";
import "./Payment.css"; import "./Payment.css";
import { CardElement, useElements, useStripe } from "@stripe/react-stripe-js";
function Payment() { function Payment() {
const [{ basket, user }, dispatch] = useStateValue(); const [{ basket, user }, dispatch] = useStateValue();
const stripe = useStripe();
const elements = useElements();
const handleSubmit = (e) => {};
const handleChange = (e) => {};
return ( return (
<section className="payment"> <section className="payment">
<article className="payment__container"> <article className="payment__container">
@@ -42,7 +49,11 @@ function Payment() {
<article className="payment__title"> <article className="payment__title">
<h3>Payment Method</h3> <h3>Payment Method</h3>
</article> </article>
<article className="payment__details"></article> <article className="payment__details">
<form onClick={handleSubmit}>
<CardElement onChange={handleChange} />
</form>
</article>
</article> </article>
</article> </article>
</section> </section>