Path: blob/master/src/packages/frontend/app-framework/syncdb/index.ts
1503 views
/*1Hooks and Context for working with a SyncDB object with react.23This is fairly self contained.45<SyncdbContext syncdb={...}>6react tree that uses the other hooks7</<SyncdbContext>8910- useSyncdbContext: easy access to the syncdb11const { syncdb } = useSyncdbContext();1213- useSyncdbRecord: access to a particular object in the syncdb defined by14a primary key. You can get and set it like using setValue with immediate15updates; it gets commited to the sync database with debouncing and remote16changes update it.1718[record, setRecord] = useSyncdbRecord<TypeOfRecord>({key:..., defaultValue:..., debounceMs:...})1920*/2122import useSyncdbRecord from "./use-syncdb-record";23export { useSyncdbRecord };2425export { useSyncdbContext, SyncdbContext } from "./syncdb-context";262728