useRouter
fromの使用中に以下のエラーに直面していますnext/router
。
TypeError: Cannot read property 'getBoundingClientRect' of null
import React from 'react'
import Link from 'next/link'
import { useRouter } from 'next/router'
function ActiveLink({ children, href, activeClassName }) {
const { asPath } = useRouter()
console.log(asPath)
return (
<Link href={href} />
)
}
export default ActiveLink