react-hooks
react-hooks copied to clipboard
Sync function support in useActionPending
useActionPending
actually supports sync function inside its implement except the pendingCount
state can be incremented and decremented without any meaningful case, the unexpected change of pendingCount
can cause a performance dropdown sometimes.
In case developers are not aware of the function's async or not, it is better for useActionPending
to be compatible with both, reducing unexpected change of pendingCount
state by examining function's return value.
@ice-zjchen