redux-toolkit-state
Version:
🚀 A powerful & lightweight React hook library that simplifies Redux state management with a familiar useState-like API. Built on Redux Toolkit for optimal performance.
23 lines • 953 B
TypeScript
type SetValueFunction<T> = (value: T | ((prevValue: T) => T)) => void;
type UpdateValueFunction<T> = (updates: Partial<T>) => void;
type ResetFunction = () => void;
type ReturnAction<T> = {
update: UpdateValueFunction<T>;
reset: ResetFunction;
};
export type useReduxStateReturn<T> = [T, SetValueFunction<T>, ReturnAction<T>];
/**
* Custom hook for redux State management
* @param key - Unique identifier for the redux State
* @param initialValue - Initial value for the state
* @returns [value, setValue, { update, reset }]
*/
export declare const useReduxStateWithInitial: <T>(key: string, initialValue: T) => useReduxStateReturn<T>;
/**
* Custom hook for accessing existing redux State
* @param key - Unique identifier for the redux State
* @returns [value, setValue, { update, reset }]
*/
export declare const useReduxStateExisting: <T>(key: string) => useReduxStateReturn<T>;
export {};
//# sourceMappingURL=reduxStateImpl.d.ts.map