Wraps an async function with loading and error state.
loading
error
The async function to execute. A new stable reference should be passed via useCallback to avoid unnecessary re-renders.
useCallback
An object with execute (calls the action), loading, error, and clearError (resets the error state).
execute
clearError
Wraps an async function with
loadinganderrorstate.