perf: avoid layout re-rendering
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user