mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
16 lines
792 B
TypeScript
16 lines
792 B
TypeScript
import { Comparator, Selector } from "../../core/shallow-equal.js";
|
|
//#region src/react/hooks/use-selector.d.ts
|
|
/**
|
|
* Subscribe to derived state with customizable equality check.
|
|
*
|
|
* Low-level hook used internally by `useStore` and `useSnapshot`.
|
|
*
|
|
* @param subscribe - Subscribe function that returns an unsubscribe callback.
|
|
* @param getSnapshot - Returns the current snapshot value.
|
|
* @param selector - Derives a value from the snapshot.
|
|
* @param isEqual - Custom equality function. Defaults to `shallowEqual`.
|
|
*/
|
|
declare function useSelector<S, R>(subscribe: (cb: () => void) => () => void, getSnapshot: () => S, selector: Selector<S, R>, isEqual?: Comparator<R>): R;
|
|
//#endregion
|
|
export { type Comparator, type Selector, useSelector };
|
|
//# sourceMappingURL=use-selector.d.ts.map
|