UNPKG

@lesnoypudge/utils-react

Version:

lesnoypudge's utils-react

15 lines (14 loc) 612 B
import { Dispatch, MutableRefObject, SetStateAction } from 'react'; export declare namespace useRefInjection { type Fn<_State> = Dispatch<SetStateAction<_State>>; type Ref<_State> = Readonly<MutableRefObject<_State>>; type Return<_State> = [ stateRef: Ref<_State>, setState: Fn<_State> ]; } /** * Provides a reference to a state and a setter function, with support for * state injection via an external setter function. */ export declare const useRefInjection: <_State>(initialState: _State, setStateForInjection: useRefInjection.Fn<_State>) => useRefInjection.Return<_State>;