Skip to content

Commit b3d834c

Browse files
committed
fix: router instance
1 parent 6da8325 commit b3d834c

File tree

1 file changed

+3
-2
lines changed
  • src/components/ui/markdown/renderers

1 file changed

+3
-2
lines changed

src/components/ui/markdown/renderers/link.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { memo, useCallback } from 'react'
2-
import Router from 'next/router'
2+
import { useRouter } from 'next/navigation'
33
import type { FC, ReactNode } from 'react'
44

55
import {
@@ -17,6 +17,7 @@ export const MLink: FC<{
1717
title?: string
1818
children?: ReactNode
1919
}> = memo(({ href, children, title }) => {
20+
const router = useRouter()
2021
const handleRedirect = useCallback(
2122
(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
2223
const locateUrl = new URL(location.href)
@@ -36,7 +37,7 @@ export const MLink: FC<{
3637
case 'posts':
3738
case 'notes':
3839
case 'category': {
39-
Router.push(toUrlParser.pathname)
40+
router.push(toUrlParser.pathname)
4041
break
4142
}
4243
default: {

0 commit comments

Comments
 (0)