Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 11: Updating the table(11.4) #647

Open
sabaoongfx opened this issue Apr 13, 2024 · 1 comment
Open

Chapter 11: Updating the table(11.4) #647

sabaoongfx opened this issue Apr 13, 2024 · 1 comment

Comments

@sabaoongfx
Copy link

sabaoongfx commented Apr 13, 2024

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

@aliuk2012
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants