nextjs app router. Server In route /products a searchParam property was accessed…
- User
nextjs app router. Server In route /products a searchParam property was accessed directly with
searchParams.title.searchParamsis now a Promise and should be awaited before accessing properties of the underlying searchParams object. In this version of Next.js direct access to searchParam properties is still supported to facilitate migration but in a future version you will be required to awaitsearchParams. If this use is inside an async function await it. If this use is inside a synchronous function then convert the function to async or await it from outside this function and pass the result in. // /app/products/page.jsximport React from 'react'; import ProductList from '@/components/ProductList'; import AsyncNavBar from '@/components/AsyncNavBar';
export const dynamic = 'force-dynamic';
const ProductsPage = ({ searchParams }) => { const { c = '', sc = '', b = '', title = '', sortBy = '' } = searchParams;
return ( <> <AsyncNavBar /> <ProductList initialFilters={{ c, sc, b, title, sortBy }} /> </> );};
export default ProductsPage;
- Assistant