0

I have the function serviceCalc that I want to trigger inside my handleChangePrice but I'm not sure which parameter I should pass(in this case I tried selectionValue but it doesnt work). Would there be a way to call this function inside a handleChange?

const [selectionValue, setSelectionValue] = useState("standard");
const serviceCalc = ({currentTarget: {value}}: {currentTarget: HTMLInputElement}) => {
    setSelectionValue(value);
    if(value === 'standard'){
        standard();
    }
    if(value === 'premium'){
        console.log("triggerPremium")
        // premium();
    }
    if(value === 'excelium'){
        console.log("triggerExcelium")
        // excelium();
    }
};



    const handleChangePrice = (event:any) => {
    setSelectionValue(event.target.value);
    serviceCalc(selectionValue)
}

any help is greatly appreciated

0 Answers0