Manage the BAQ record store and make it available to child components.
<Store identity={...}>
...
</Store>
<Store>
Provide a record store to all components inside. This is required when using any of the store hooks (useRecordQuery
, useStaticRecordQuery
, and so on).
identity
StoreIdentity
useAuthentication
hook, or manually constructed.<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>
);
}