1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +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

@ -6,15 +6,14 @@ import { path } from 'ramda';
import styles from './styles.module.scss';
import { useHistory } from 'react-router';
import { URLS } from '~/constants/urls';
import { useGotoNode } from '~/utils/hooks/node/useGotoNode';
const LabText: FC<INodeComponentProps> = ({ node }) => {
const content = useMemo(() => formatTextParagraphs(path(['blocks', 0, 'text'], node) || ''), [
node.blocks,
]);
const history = useHistory();
const onClick = useCallback(() => history.push(URLS.NODE_URL(node.id)), [node.id]);
const onClick = useGotoNode(node.id);
return (
<Markdown