react-fhirclient
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

React FHIR Client

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

Getting started

  1. Add your FhirClientProvider to your ReactDOM tree.
ReactDOM.render(
  <React.StrictMode>
    <FhirClientProvider>
      <App />
    </FhirClientProvider>
  </React.StrictMode>,
  document.getElementById('root')
);
  1. Use useFhirClient() in your hooks.
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;
  1. Learn fhirclient.

This project uses fhirclient under the hood. Check out it's documentation.

Readme

Keywords

none

Package Sidebar

Install

npm i react-fhirclient

Weekly Downloads

27

Version

0.1.1

License

MIT

Unpacked Size

10 kB

Total Files

6

Last publish

Collaborators

  • soneill