Files
free-your-brain/src/app/components/popup-list-item/PopupListItem.tsx
Max Nikitin 38d70b3f39 Изменение способа открытия модалки выбора создания (#80)
Изменение способа открытия модалки выбора создания
2021-02-04 11:49:28 +03:00

25 lines
593 B
TypeScript

import {ListItem, ListItemText} from '@material-ui/core';
import React, {memo, useCallback} from 'react';
import {useHistory} from 'react-router-dom';
type PopupListItemProps = {
item: string;
url: string;
};
const PopupListItem: React.FC<PopupListItemProps> = ({item, url}) => {
const history = useHistory();
const handleClick = useCallback(() => {
history.push(url);
}, [history, url]);
return (
<ListItem button onClick={handleClick}>
<ListItemText primary={item} />
</ListItem>
);
};
export default memo(PopupListItem);