Skip to content

Instantly share code, notes, and snippets.

@ac12644
Created January 30, 2022 19:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ac12644/9faec855f937b70d29077b5947a11f5c to your computer and use it in GitHub Desktop.
Save ac12644/9faec855f937b70d29077b5947a11f5c to your computer and use it in GitHub Desktop.
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