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
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
The text was updated successfully, but these errors were encountered:
Thanks this works for me, also a reminder that the file should have tsx extension instead of jsx else it will not work
tsx
jsx
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](https://cdn.statically.io/img/private-user-images.githubusercontent.com/165472223/322208994-de582605-6460-4e67-aedb-19fbeb2fdd4b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA3MjQ2NDAsIm5iZiI6MTcyMDcyNDM0MCwicGF0aCI6Ii8xNjU0NzIyMjMvMzIyMjA4OTk0LWRlNTgyNjA1LTY0NjAtNGU2Ny1hZWRiLTE5ZmJlYjJmZGQ0Yi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxMVQxODU5MDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03NTlmYWYwMWEwYTk3MTFjZmYxMDY5MTNjOTIwNjQ0OTBmODZjODcwNjgwMjc2NTE3MDc5OWZjNzBiMTJhMjkzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.mTsQYwww5lOmtM2G7GJXRPTyrtrs5oXGa7ij4sMTg4Y)
// After implementing Solution
![image](https://cdn.statically.io/img/private-user-images.githubusercontent.com/165472223/322209087-5d44fdd4-14c0-4a4b-b403-1bd69941c0dc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA3MjQ2NDAsIm5iZiI6MTcyMDcyNDM0MCwicGF0aCI6Ii8xNjU0NzIyMjMvMzIyMjA5MDg3LTVkNDRmZGQ0LTE0YzAtNGE0Yi1iNDAzLTFiZDY5OTQxYzBkYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxMVQxODU5MDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wNDQxYmM4ZmJkZjY0NDZmODY2Y2U2MDc1MTJhNjI3YzNiZDc3ODVhYTQ5YzFjODgxMmE3NDVkZGNkYjQxYTBlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.ZcKPMfIb2MUZW4qQAsdncGBAnYaTi0MpMtCKD-SwPZk)
The text was updated successfully, but these errors were encountered: