perf: avoid layout re-rendering

This commit is contained in:
Riccardo
2024-01-25 18:12:37 +01:00
parent 551bff815f
commit dbefdc49e2
15 changed files with 137 additions and 135 deletions

View File

@@ -1,5 +1,6 @@
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { Link } from './link';
import { CustomLink } from './customLink';
const links = [{ name: 'Subscribe', path: '/' }];
@@ -11,12 +12,12 @@ function Footer() {
{pathname === '/' ? (
<p className='text-center text-xs text-gray-600'>
By subscribing, you agree to our{' '}
<a
<Link
className='font-medium text-indigo-600 hover:text-indigo-500'
href='/privacy'
>
Privacy Policy
</a>
</Link>
.
</p>
) : (
@@ -25,11 +26,11 @@ function Footer() {
link =>
pathname !== link.path &&
!(pathname === '/confirmation' && link.path === '/') && (
<Link key={link.path} path={link.path} text={link.name} />
<CustomLink key={link.path} path={link.path} text={link.name} />
)
)}
{pathname === '/privacy' && (
<Link path='/unsubscribe' text='Unsubscribe' />
<CustomLink path='/unsubscribe' text='Unsubscribe' />
)}
</ul>
)}