React SDK

Store

Manage the BAQ record store and make it available to child components.

<Store identity={...}>
  ...
</Store>

Provide a record store to all components inside. This is required when using any of the store hooks (useRecordQuery, useStaticRecordQuery, and so on).

Props

Notes

  • The <Store> requires an authenticated user. To query public BAQ data without authentication, use a Client­ directly.

Use the useAuthentication­ hook to obtain a StoreIdentity­ object to use with the <Store>.

import {buildAuthentication} from "../baq/authentication.js";
import {Store} from "./baq/store.js";

const {useAuthentication} = buildAuthentication({...});

function App() {
  const authentication = useAuthentication();

  if (authentication.status !== "authenticated") {
    return;
  }

  return (
    <Store identity={authentication.identity}>
      <Home /> {/* Rest of the app */}
    </Store>
  );
}
© 2024 Quentez