)}
- )
+ )
>
}
function EquationOperator(p) {
const {equation,setEquation,data,operator,key,id} = p
+ const [op,setOp] = useState(operator)
+
+ useEffect(()=>{
+ var eqArr = [...equation]
+ eqArr[id] = op
+ setEquation(eqArr)
+ },[op])
+
return <>
{operator}
>
@@ -25,9 +39,19 @@ function EquationOperator(p) {
function EquationValue(p) {
const {equation,setEquation,data,val,key,id} = p
- return <>
+ const [item,setItem] = useState(val)
+
+ useEffect(()=>{
+ var eqArr = [...equation]
+ eqArr[id] = item
+ setEquation(eqArr)
+ },[item])
+
+ return
+ {val}
+
{data[val]}
- >
+
}
function Equation(p) {