You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use this in place of react's useCallback(), and was wondering if a dependency array is required as I don't see one in the signature. Based on the usage examples, I get a sense that this isn't meant to replace it?
The text was updated successfully, but these errors were encountered:
No this is not like reacts useCallback. Instead you use useAsyncCallback when you want to control when the async operation happens. E.g. on a form submit.
you could do something like:
// where createUser is your async function that creates you a user
const createUserAsync = useAsyncCallback(createUser);
const onSubmit = (values) => createUserAsync.execute(values);
<form onSubmit={onSubmit}>
<input name="email" />
<input name="password" type="password" />
</form>
I'm trying to use this in place of react's
useCallback()
, and was wondering if a dependency array is required as I don't see one in the signature. Based on the usage examples, I get a sense that this isn't meant to replace it?The text was updated successfully, but these errors were encountered: