Dev Helpers
← Back

Warehouse aisle query

Place this file at app/warehouse/page.tsx in an App Router project.

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>
  );
}