Skip to content

Commit

Permalink
Merge pull request #21 from UniqueClone/main
Browse files Browse the repository at this point in the history
Fixing interest rates.
  • Loading branch information
UniqueClone authored Jun 26, 2024
2 parents c912caf + e7cee2f commit 6e65295
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/MortgageDetails/MortgageDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export const MortgageDetails: React.FC<MortgageDetailsProps> = (
props: MortgageDetailsProps
) => {
const { interestRate, maxLoan, term } = props;
const [localInterestRate, setLocalInterestRate] = React.useState<
number | undefined
>(interestRate ?? 4.0);
console.log(interestRate);
const [localInterestRate, setLocalInterestRate] = React.useState<number>(
interestRate ?? 4.0
);
const [houseValue, setHouseValue] = React.useState<number>(0);
const [loanAmount, setLoanAmount] = React.useState<number>(0);

Expand Down Expand Up @@ -156,7 +157,11 @@ export const MortgageDetails: React.FC<MortgageDetailsProps> = (
<Stack.Item grow>
<Text variant="xLarge" style={{ color: "lightgreen" }}>
{formatter.format(
getMonthlyPayment(loanAmount, interestRate ?? 3.8, term)
getMonthlyPayment(
loanAmount,
interestRate ?? localInterestRate,
term
)
)}
</Text>
</Stack.Item>
Expand Down

0 comments on commit 6e65295

Please sign in to comment.