Open this example in the interactive library
Source code
// app/warehouse/page.tsx
export default async function WarehouseAisleQuery({
searchParams,
}: {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
const bins = [
{ id: "A01", sku: "pen", qty: 12, limit: 20 },
{ id: "B04", sku: "pad", qty: 3, limit: 15 },
{ id: "A09", sku: "pen", qty: 5, limit: 10 },
];
const { aisle } = await searchParams;
return (
<ul>
{bins
.filter((b) => b.id.startsWith(typeof aisle === "string" ? aisle : ""))
.map((b) => (
<li key={b.id}>
{b.id} · {b.sku}
</li>
))}
</ul>
);
}
