In one file, I have
export const useAlertMachine = () => {
const updateAlertsMutation = useUpdateAlerts();
return {
updateAlertsMutation
};
};
updateAlertsMutation
has states isLoading
, isSuccess
, isIdle
, and isError
. I want to be able to access these states in another file. For example,
import {useAlertMachine} from '+/machines/alertMachine'
const Alert = () => {
const {updateAlertsMutation} = useAlertMachine();
// want to access updateAlertsMutation.isLoading here, referring to the mutation defined in the first file
}
Right now, each instance of updateAlertsMutation
is independent - is it possible to access its state across files?