Socket
Socket
Sign inDemoInstall

@medplum/react-hooks

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@medplum/react-hooks - npm Package Compare versions

Comparing version 2.1.14 to 2.1.15

4

dist/types.d.ts

@@ -10,3 +10,3 @@ /// <reference types="react" />

import { QueryTypes } from '@medplum/core';
import { default as React_2 } from 'react';
import { ReactNode } from 'react';
import { Reference } from '@medplum/fhirtypes';

@@ -38,3 +38,3 @@ import { Resource } from '@medplum/fhirtypes';

navigate?: MepdlumNavigateFunction;
children: React_2.ReactNode;
children: ReactNode;
}

@@ -41,0 +41,0 @@

{
"name": "@medplum/react-hooks",
"version": "2.1.14",
"version": "2.1.15",
"description": "Medplum React Hooks Library",

@@ -5,0 +5,0 @@ "keywords": [

@@ -59,2 +59,29 @@ # Medplum React Hooks Library

## `useMedplumContext`
`useMedplumContext` can be used to access the `MedplumContext` provided by the `MedplumProvider` directly. The `MedplumContext` has the following interface:
```ts
interface MedplumContext {
medplum: MedplumClient;
navigate: MepdlumNavigateFunction;
profile?: ProfileResource;
loading: boolean;
}
```
### Using `loading` to know when `MedplumClient` initialization is done
You can use the `loading` property from `useMedplumContext()` to know when `MedplumClient` has finished initialization successfully. `loading` is updated asynchronously so it will usually start as `false` and change to `true` once the client has finished its initialization.
```tsx
function MyComponent(): JSX.Element {
const { loading } = useMedplumContext();
return loading ? (
<Spinner />
) : (
<div>Loaded!</div>
);
}
```
## About Medplum

@@ -61,0 +88,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc