@lesnoypudge/utils-react
Version:
lesnoypudge's utils-react
14 lines (13 loc) • 525 B
TypeScript
import { useRefInjection } from '../useRefInjection';
export declare namespace useStateWithRef {
type Return<_State> = [
state: _State,
stateRef: useRefInjection.Ref<_State>,
setState: useRefInjection.Fn<_State>
];
}
/**
* Provides a state with a reference to its value and a setter function,
* while also supporting state injection via an external setter function.
*/
export declare const useStateWithRef: <_State>(initialState: _State | (() => _State)) => useStateWithRef.Return<_State>;