我正在学习nextjs和我试图导航到ab组件在nextjs与链接组件可以任何人都可以请告诉我如何正确地做事情目前它给我404这个页面找不到。错误当我尝试这样做
页脚:
import React from 'react'
import Link from 'next/link'
export default function Footer() {
return (
<footer className="bg-black-800 py-12">
<div className="container mx-auto px-4">
<div className="flex flex-wrap justify-between">
<nav className="w-full lg:w-auto lg:flex-1 lg:text-center flex flex-wrap justify-center">
<Link href="/ab" className="footer-link mr-4">
<span>Privacy Policy</span>
</Link>
<Link href="/terms" className="footer-link mr-4">
<span>Terms of Service</span>
</Link>
</nav>
</div>
</div>
</footer>
)
}
组件:
import React from 'react'
export default function ab() {
return (
<div>
<h1>Hello From compoent</h1>
</div>
)
}
2条答案
按热度按时间wpx232ag1#
您应该在pages目录中有一个ab.js文件,该文件中应该有如下代码
rqdpfwrv2#