useEffectWithPreviousValues
FunctionuseEffectWithPreviousValues(callback: (preValues: readonlyunknown[]) => void, dependencies: readonlyunknown[]): voidWrapper of useEffect, the callback can get the previous values of dependencies.
Parameters
| Parameter | Type | Notes |
|---|---|---|
callback | (preValues: readonlyunknown[]) => void | |
dependencies | readonlyunknown[] | dependencies must be a non-empty array and the length should not change example: |
Returns
void