Skip to main content
Glama
HealthGorillaLabOrderProvider.tsx1.84 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { JSX, PropsWithChildren } from 'react'; import type { UseHealthGorillaLabOrderReturn } from './HealthGorillaLabOrderContext'; import { HealthGorillaLabOrderContext } from './HealthGorillaLabOrderContext'; /** * A provider component that propagates the `useHealthGorillaLabOrder` return value to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useHealthGorillaLabOrderContext}. * * @param props - entire response of `useHealthGorillaLabOrder` * @returns a React context provider component. * * @example * ```tsx * function App() { * const labOrderReturn = useHealthGorillaLabOrder({...}); * return ( * <HealthGorillaLabOrderProvider {...methods} > * <form onSubmit={labOrderReturn.createOrderBundle()}> * <PerformingLabInput /> * <input type="submit" /> * </form> * </HealthGorillaLabOrderProvider> * ); * } * * function PerformingLabInput() { * const { searchAvailableLabs, setPerformingLab } = useHealthGorillaLabOrderContext(); * return ( * <AsyncAutocomplete<LabOrganization> * maxValues={1} * loadOptions={searchAvailableLabs} * onChange={(item) => { * if (item.length > 0) { * setPerformingLab(item[0]); * } else { * setPerformingLab(undefined); * } * }} * /> * ); * } * ``` */ export function HealthGorillaLabOrderProvider(props: PropsWithChildren<UseHealthGorillaLabOrderReturn>): JSX.Element { const { children, ...labOrderReturn } = props; return ( <HealthGorillaLabOrderContext.Provider value={labOrderReturn}>{children}</HealthGorillaLabOrderContext.Provider> ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server