# react-fhirclient

> > React Hooks for fhirclient. Use fhirclient with an easy React Hook.

Latest version **0.1.1** (published 2020-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-fhirclient
pnpm add react-fhirclient
yarn add react-fhirclient
bun add react-fhirclient
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2020-11-28 |
| First published | 2020-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shane O'Neill |
| Maintainers | soneill |

## Links

- npm: https://www.npmjs.com/package/react-fhirclient
- npm.io page: https://npm.io/package/react-fhirclient

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^17.0.1
- [fhirclient](https://npm.io/package/fhirclient.md) ^2.3.10

## Recent versions

- 0.1.1 (latest) — 2020-11-28
- 0.1.0 — 2020-11-27

## README

# React FHIR Client

> React Hooks for fhirclient. Use fhirclient with an easy React Hook.

## Getting started

1. Add your `FhirClientProvider` to your ReactDOM tree.

```js
ReactDOM.render(
  <React.StrictMode>
    <FhirClientProvider>
      <App />
    </FhirClientProvider>
  </React.StrictMode>,
  document.getElementById('root')
);
```

2. Use `useFhirClient()` in your hooks.

```js
import { useState, useEffect } from 'react';
import { useFhirClient } from 'react-fhirclient';

function App() {
  const [patient, setPatient] = useState();
  const fhirclient = useFhirClient();

  useEffect(() => {
    const getPatient = async () => {
      if (fhirclient) {
        const patient = await fhirclient.request(`Patient/${fhirclient.patient.id}`);
        setPatient(patient);
      }
    };
    getPatient();
  }, []);

  return (
    <div className="App">
      <pre>
        <code>{JSON.stringify(patient, null, 2)}</code>
      </pre>
    </div>
  );
}

export default App;
```

3. Learn `fhirclient`.

This project uses [fhirclient](https://github.com/smart-on-fhir/client-js) under the hood. Check out it's [documentation](http://docs.smarthealthit.org/client-js/).

---
_Source: https://npm.io/package/react-fhirclient · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
