Skip to main content

<FhirFormatter />

The <FhirFormatter /> is a variation of the <FhirValue /> that is intended to compose better with the formatter message API:

Example usage

const patientQuery = useFhirRead("Patient", "123");
const patient = patientQuery.data;

<FhirFormatter
format={(f) =>
f.message`${["HumanName", patient?.name, { max: 1 }]}${[
"date",
patient?.birthDate,
{ decorator: " (born {})" },
]}`
}
/>;

Preview

<FhirFormatter
format={(f) =>
f.message`Name: ${["HumanName", patient.name]}${[
"boolean",
patient.active,
{ decorator: ", Active: {}" },
]}`
}
/>