Demo React bindings over the same vanilla core

React example

@smart-health-checkin/client/react wraps the <smart-checkin-picker> element as a component. It's the same UI every page gets, with callbacks for the result. Pages that draw their own buttons can use the useCheckin hook from the same module instead.

The component

import { CheckinPicker } from "@smart-health-checkin/client/react";

<CheckinPicker
  request={REQUEST}
  registry="/wallets.json"
  onResponse={({ response }) => setResponse(response)}
  onDeclined={() => setNote("Nothing was shared.")}
/>

Or draw your own buttons

import { useCheckin } from "@smart-health-checkin/client/react";

const { wallets, start, status, response } = useCheckin(REQUEST, { registry: "/wallets.json" });

// start(wallet) opens a web wallet's tab inside the click, so call it from onClick
{wallets.filter((w) => w.available).map((w) => (
  <button key={w.id} onClick={() => start(w)}>{w.name}</button>
))}