From ca044349cac7434560f2646bc4ea4c27f5783d47 Mon Sep 17 00:00:00 2001
From: Rosyid Haryadi <rosyid_haryadi@protonmail.com>
Date: Sat, 30 Sep 2023 18:29:36 +0700
Subject: cursed state management

---
 src/SalaryInput.jsx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'src/SalaryInput.jsx')

diff --git a/src/SalaryInput.jsx b/src/SalaryInput.jsx
index f04c68f..753d457 100644
--- a/src/SalaryInput.jsx
+++ b/src/SalaryInput.jsx
@@ -2,8 +2,8 @@ import { useState } from "react";
 import TextField from "@mui/material/TextField";
 import { NumericFormat } from "react-number-format";
 
-function SalaryInput() {
-    const [displayValue, setDisplayValue] = useState('');
+function SalaryInput({handleBaseSalaryChange}) {
+    const [baseSalary, setBaseSalary] = useState('');
     return (
         <NumericFormat
             customInput={ TextField }
@@ -11,8 +11,11 @@ function SalaryInput() {
             variant="outlined"
             valueIsNumericString={true}
             thousandSeparator={true}
-            value={displayValue}
-            onValueChange={(value, sourceInfo) => {setDisplayValue(value.value)}}
+            value={baseSalary}
+            onValueChange={(value, sourceInfo) => {
+                setBaseSalary(value.value);
+                handleBaseSalaryChange(value.value);
+            }}
             InputProps={{
                 startAdornment: <span>Rp</span>
             }}
-- 
cgit v1.2.3-70-g09d2

