next-learn icon indicating copy to clipboard operation
next-learn copied to clipboard

Chapter 11: Updating the table(11.4)

Open sabaoongfx opened this issue 10 months ago • 1 comments

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 image

// After implementing Solution image

sabaoongfx avatar Apr 13 '24 13:04 sabaoongfx

Thanks this works for me, also a reminder that the file should have tsx extension instead of jsx else it will not work

aliuk2012 avatar Apr 19 '24 09:04 aliuk2012