Fixed the prop drill

This commit was merged in pull request #286.
This commit is contained in:
2023-07-10 19:22:03 +01:00
parent 2e25b33110
commit 6daa4d6d43
5 changed files with 36 additions and 24 deletions
+11 -7
View File
@@ -1,14 +1,14 @@
import React, { useState } from "react";
import RecentActivityTable from "./WalletComponent/RecentActivityTable";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import { useNavigate, useLocation } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import InputCom from "../Helpers/Inputs/InputCom";
import AddFundDollars from "./AddFundDollars";
function AddFund({ payment }) {
function AddFund({ paymentHistory, currency }) {
const navigate = useNavigate();
const { currency } = useLocation()?.state; //GETS THE USER CURRENCY FOR ADD FUND
// const { currency } = useLocation()?.state; //GETS THE USER CURRENCY FOR ADD FUND
//STATE FOR CONTROLLED INPUT
let [input, setInput] = useState("");
@@ -42,6 +42,8 @@ function AddFund({ payment }) {
setInput("");
};
console.log("walletItem >>", paymentHistory);
return (
<div>
{/* heading */}
@@ -134,13 +136,15 @@ function AddFund({ payment }) {
<div className="lg:w-2/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-full min-h-[590px] bg-white dark:bg-dark-white rounded-2xl shadow">
<h2 className="text-gray-900 dark:text-white text-xl lg:text-2xl font-medium">
Recent Activity
{/* Recent Activity */}Working in Progress
</h2>
<p>This popup has taking time because of the prop drilling. I have got it right now</p>
{/* <p className='text-base text-gray-600 dark:text-white'>Activity Report</p> */}
{payment.loading ? (
{paymentHistory?.loading ? (
<LoadingSpinner size="16" color="sky-blue" />
) : (
<RecentActivityTable payment={payment} />
// <RecentActivityTable payment={paymentHistory} />
""
)}
</div>
</div>
@@ -150,4 +154,4 @@ function AddFund({ payment }) {
);
}
export default AddFund;
export default AddFund;