Fix TS definitions
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
7fd6d4498f
commit
c8b99b54e0
2 changed files with 2 additions and 2 deletions
|
@ -204,7 +204,7 @@ export const RovingTabIndexProvider: React.FC<IProps> = ({children, handleHomeEn
|
||||||
// onFocus should be called when the index gained focus in any manner
|
// onFocus should be called when the index gained focus in any manner
|
||||||
// isActive should be used to set tabIndex in a manner such as `tabIndex={isActive ? 0 : -1}`
|
// isActive should be used to set tabIndex in a manner such as `tabIndex={isActive ? 0 : -1}`
|
||||||
// ref should be passed to a DOM node which will be used for DOM compareDocumentPosition
|
// ref should be passed to a DOM node which will be used for DOM compareDocumentPosition
|
||||||
export const useRovingTabIndex = (inputRef: Ref): [FocusHandler, boolean, Ref] => {
|
export const useRovingTabIndex = (inputRef?: Ref): [FocusHandler, boolean, Ref] => {
|
||||||
const context = useContext(RovingTabIndexContext);
|
const context = useContext(RovingTabIndexContext);
|
||||||
let ref = useRef<HTMLElement>(null);
|
let ref = useRef<HTMLElement>(null);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ const getValue = <T>(key: string, initialValue: T): T => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Hook behaving like useState but persisting the value to localStorage. Returns same as useState
|
// Hook behaving like useState but persisting the value to localStorage. Returns same as useState
|
||||||
export const useLocalStorageState = <T>(key: string, initialValue: T) => {
|
export const useLocalStorageState = <T>(key: string, initialValue: T): [T, Dispatch<SetStateAction<T>>] => {
|
||||||
const lsKey = "mx_" + key;
|
const lsKey = "mx_" + key;
|
||||||
|
|
||||||
const [value, setValue] = useState<T>(getValue(lsKey, initialValue));
|
const [value, setValue] = useState<T>(getValue(lsKey, initialValue));
|
||||||
|
|
Loading…
Reference in a new issue