next-learn
next-learn copied to clipboard
Chapter 11: Updating the table(11.4)
Instead of:
/* export default async function Page({ searchParams, }: { searchParams?: { query?: string; page?: string; }; }) { const query = searchParams?.query || ''; const currentPage = Number(searchParams?.page) || 1; */
// Which throws an error
//Solution:
interface SearchParams { query?: string; page?: string; }
export default async function Page({ searchParams }: { searchParams?: SearchParams }) { const query = searchParams?.query || ''; const currentPage = Number(searchParams?.page) || 1;
// Error Screenshot
// After implementing Solution
Thanks this works for me, also a reminder that the file should have tsx
extension instead of jsx
else it will not work