I have onClick event, that is a trigger for couple functions. FunctionsetRcomForApi(rcom) sets valuesip1, port1 for function getApiVersion(ip1, port1). The problem is - on first click ip1, port1 are undefined. I've tried to use callback - but it didn't work...
const onClick = () => {
setIndexPpk(index);
setRcomForApi(rcom); //sets ip1 and port1 in Context State.
getApiVersion(ip1, port1); // on first click both undefined
};
Promise? Also, areip1, port1both stateful values?