Migrate util, types, state, sticker-creator to ESLint
This commit is contained in:
parent
372aa44e49
commit
2ade4acd52
115 changed files with 647 additions and 448 deletions
|
@ -5,16 +5,17 @@ import { useDispatch } from 'react-redux';
|
|||
// Restore focus on teardown
|
||||
export const useRestoreFocus = (
|
||||
// The ref for the element to receive initial focus
|
||||
focusRef: React.RefObject<any>,
|
||||
focusRef: React.RefObject<HTMLElement>,
|
||||
// Allow for an optional root element that must exist
|
||||
root: boolean | HTMLElement | null = true
|
||||
) => {
|
||||
): void => {
|
||||
React.useEffect(() => {
|
||||
if (!root) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const lastFocused = document.activeElement as any;
|
||||
const lastFocused = document.activeElement as HTMLElement;
|
||||
|
||||
if (focusRef.current) {
|
||||
focusRef.current.focus();
|
||||
}
|
||||
|
@ -33,10 +34,10 @@ export const useRestoreFocus = (
|
|||
|
||||
export const useBoundActions = <T extends ActionCreatorsMapObject>(
|
||||
actions: T
|
||||
) => {
|
||||
): T => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
return React.useMemo(() => {
|
||||
return bindActionCreators(actions, dispatch);
|
||||
}, [dispatch]);
|
||||
}, [actions, dispatch]);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue