Skip to content

Commit a0384f0

Browse files
committed
fix params type in app router
1 parent fda7eb2 commit a0384f0

File tree

2 files changed

+8
-6
lines changed
  • examples/app-router/src/app

2 files changed

+8
-6
lines changed

examples/app-router/src/app/forced-color-scheme/[colorScheme]/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import type { ColorSchemeType } from "nextjs-themes";
22
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";
33

44
interface PageWithForcedColorSchemeProps {
5-
params: { colorScheme: ColorSchemeType };
5+
params: Promise<{ colorScheme: ColorSchemeType }>;
66
}
77

8-
export default function PageWithForcedColorScheme({
9-
params: { colorScheme },
10-
}: PageWithForcedColorSchemeProps): JSX.Element {
8+
export default async function PageWithForcedColorScheme({
9+
params,
10+
}: PageWithForcedColorSchemeProps) {
11+
const { colorScheme } = await params;
1112
return (
1213
<>
1314
<ForceColorScheme colorScheme={colorScheme} />

examples/app-router/src/app/themed-page/[theme]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { ForceTheme } from "nextjs-themes/force-theme";
22

33
interface PageProps {
4-
params: { theme: string };
4+
params: Promise<{ theme: string }>;
55
}
66

7-
export default function PageWithForcedTheme({ params: { theme } }: PageProps): JSX.Element {
7+
export default async function PageWithForcedTheme({ params }: PageProps) {
8+
const { theme } = await params;
89
return (
910
<>
1011
<ForceTheme theme={theme} />

0 commit comments

Comments
 (0)