skip to Main Content

Reactjs – Variable not being updated in function –

const [isValid, setisValid] = useState(false); const GetData = () => { debugger; if (type.isValid === "true") { setisValid (true); } else { setisValid(false); } GetMyData(ID, isValid) .then((response) => { if (componentMounted.current) { const apiResult: ApiResult<ItemApproval> = response.data; if (!apiResult?.success &&…

VIEW QUESTION
Back To Top
Search