ayanami
Version:
A better way to react with state
8 lines (7 loc) • 465 B
TypeScript
import { ActionMethodOfAyanami, Ayanami } from '../core';
export interface UseAyanamiInstanceConfig<S = unknown, U = unknown> {
destroyWhenUnmount?: boolean;
selector?: (state: S) => U;
}
export declare type UseAyanamiInstanceResult<M extends Ayanami<S>, S, U> = [U, ActionMethodOfAyanami<M, S>];
export declare function useAyanamiInstance<M extends Ayanami<S>, S, U>(ayanami: M, config?: UseAyanamiInstanceConfig<S, U>): UseAyanamiInstanceResult<M, S, U>;