Skip to main content

Next.js

npm

npm install @bonfhir/next

useFhirSearchController

When in an Next.js app, you can substitute the base useFhirSearchController for the Next.js version, like so:

import { OrganizationSortOrder } from "@bonfhir/core/r4b";
import { useFhirSearchController } from "@bonfhir/next/r4b/client";

// The first argument is a scope - it allows multiple search controllers to be on the same page.
const orgsSearchController = useFhirSearchController<OrganizationSortOrder>(
"search",
{
defaultSort: "name",
pageSize: 20,
},
);

It offers the same features as the original, but is already integrated with the Next.js router by default.