Dev Helpers

Next.js / Public park finder

Easiest park recommendation

Dev Helpers · July 20, 2025

A recommendation needs a scoring rule that readers can understand. An equal score or an empty candidate list requires an intentional fallback.

Worked example

// app/parks/page.tsx

export default function EasiestParkRecommendation() {
  const parks = [
    { name: "Cedar", km: 2.4, features: ["shade", "water"], grade: 1 },
    { name: "Ridge", km: 6.1, features: ["views"], grade: 3 },
    { name: "Lake", km: 3.5, features: ["water", "views"], grade: 2 },
  ];
  const p = [...parks].sort((a, b) => a.grade - b.grade || a.km - b.km)[0];
  return (
    <section>
      <h1>Gentle trail</h1>
      <p>
        {p.name} · grade {p.grade} · {p.km} km
      </p>
    </section>
  );
}

Implementation notes

Difficulty alone may not reflect accessibility, distance or seasonal availability. State the scoring criterion next to the recommendation.

Try it yourself

Compare two parks with identical difficulty and a filter that removes every park.

Open the Next.js example →

Editorial date July 20, 2025 · Published December 6, 2026

Related articles

Free bin volume

Free storage volume depends on consistent dimensions and units. Derive capacity and usage in the same unit before formatting a human-readable summary.

Draft preview indexing

Draft pages need deliberate indexing metadata. An indexing directive controls crawler intent, while access to unpublished material needs a separate permission check.

Party size allocation

Allocating a party into groups is an integer problem. The remainder determines whether another group is needed and how full it will be.