< Link>从next-intl/server导致重新加载

62lalag4  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(107)

我使用nextjs v13.4(应用路由器)与国际化,特别是[[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection),并遵循相同的指南,因为他们的官方文档建议下一个服务器端组件。资源:official docs for next-intl
但是我不明白为什么来自next-intl/server的链接会导致页面重新加载。

import {useTranslations} from 'next-intl';
import Link from 'next-intl/server';

export default function Home() {

  const t = useTranslations('Main');
  return (
   <div className='bg-rose-500'>
    <p>{t('title')}</p>

    <Link href="/en" >EN</Link>{" "}
    <Link href="/de" >DE</Link>

   </div>
  )
}
83qze16e

83qze16e1#

我使用next/link解决了这个问题,如下所示:

import Link from 'next/link';

<Link href="/en/about">
</Link>

而不是

import Link from 'next-intl/link';

<Link href="/about" locale="en">
</Link>

相关问题