Skip to content

Commit bbbabf2

Browse files
authored
fix: render footer year on client
1 parent b2d215f commit bbbabf2

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

app/current-year.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use client";
2+
3+
import { useSyncExternalStore } from "react";
4+
5+
const emptySubscribe = () => () => {};
6+
7+
export default function CurrentYear() {
8+
const year = useSyncExternalStore(
9+
emptySubscribe,
10+
() => new Date().getFullYear(),
11+
() => null,
12+
);
13+
14+
return year;
15+
}

app/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Image from "next/image";
2+
import CurrentYear from "./current-year";
23

34
export default function Home() {
45
return (
@@ -77,7 +78,7 @@ export default function Home() {
7778
{/* ── Footer ────────────────────────────────────────────── */}
7879
<footer className="relative z-10 pb-8 text-center">
7980
<p className="text-zinc-600 text-sm">
80-
© {new Date().getFullYear()} Python Colombia
81+
© <CurrentYear /> Python Colombia
8182
<span className="mx-2 text-zinc-700">·</span>
8283
Comunidad de Python en Colombia
8384
</p>

0 commit comments

Comments
 (0)