mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
made transitional Anchor component for next/cra
This commit is contained in:
parent
8bac6bb2f7
commit
7658068caa
12 changed files with 57 additions and 28 deletions
16
src/components/common/Anchor/index.tsx
Normal file
16
src/components/common/Anchor/index.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import React, { VFC } from 'react';
|
||||
import { LinkProps } from '~/utils/types';
|
||||
import { CONFIG } from '~/utils/config';
|
||||
import NextLink from 'next/link';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
interface AnchorProps extends LinkProps {}
|
||||
|
||||
const Anchor: VFC<AnchorProps> = ({ ref, href, ...rest }) =>
|
||||
CONFIG.isNextEnvironment ? (
|
||||
<NextLink {...rest} href={href ?? ''} />
|
||||
) : (
|
||||
<Link {...rest} to={href ?? ''} />
|
||||
);
|
||||
|
||||
export { Anchor };
|
Loading…
Add table
Add a link
Reference in a new issue