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.
15 lines (14 loc) • 387 B
JavaScript
import { useReduxStateExisting, useReduxStateWithInitial, } from '../impl/reduxStateImpl';
/**
* Implementation of useReduxState hook
*
* @param key
* @param initialValue
* @returns
*/
export function useReduxState(key, initialValue) {
if (initialValue === undefined) {
return useReduxStateExisting(key);
}
return useReduxStateWithInitial(key, initialValue);
}