refactor: Component/BackBtn
parent
733c1c0fec
commit
96c8017271
@ -0,0 +1,16 @@
|
||||
import { createContext, useContext, useEffect, useState } from 'react';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from 'antd';
|
||||
import { isNotEmpty } from '@/utils/commons';
|
||||
|
||||
const BackBtn = ({to, ...props}) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<>
|
||||
{isNotEmpty(to) ? <Link to={to}>{t('Back')}l</Link> : <Button type='link' onClick={() => navigate(-1)}>{t('Back')}</Button>}
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default BackBtn;
|
Loading…
Reference in New Issue