I want to use my fetched API result outside of the function.
apiFetch({
url: lmn_admin.ajax_url,
method: "POST",
body: formData,
})
.then((result) => {
setIsLoading(false);
setIsSuccess(true);
console.log(result);
})
.catch((error) => {
setIsLoading(false);
setIsError(true);
console.error(error);
});