Created
January 30, 2022 19:05
-
-
Save ac12644/9faec855f937b70d29077b5947a11f5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
const Receipts = (props) => { | |
const [ donation, setDonation ] = useState(null); | |
const [ fundName, setFundName ] = useState(null); | |
const [ date, setDate ] = useState(null); | |
useEffect(() => { | |
const { donation, date, fund } = props.location.state; | |
const formattedDate = new Date(parseInt(date * 1000)); | |
setDonation(donation); | |
setDate(formattedDate.toString()); | |
setFundName(fund); | |
}, []); | |
return ( | |
<div className="receipt-container"> | |
<div className="receipt-header"> | |
<h3> | |
Thank you for your donation to {fundName} | |
</h3> | |
</div> | |
<div className="receipt-info"> | |
<div> | |
Date of Donation: {date} | |
</div> | |
<div> | |
Donation Value: ${donation} | |
</div> | |
</div> | |
</div> | |
); | |
} | |
export default Receipts; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment