1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

fixed lab node click handlers with hooks

This commit is contained in:
Fedor Katurov 2021-03-31 14:43:01 +07:00
parent 1db5c64d06
commit d865067eaf
6 changed files with 26 additions and 18 deletions

View file

@ -0,0 +1,10 @@
import { INode } from '~/redux/types';
import { useHistory } from 'react-router';
import { useCallback } from 'react';
import { URLS } from '~/constants/urls';
// useGotoNode returns fn, that navigates to node
export const useGotoNode = (id: INode['id']) => {
const history = useHistory();
return useCallback(() => history.push(URLS.NODE_URL(id)), [id]);
};