MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / useBoolean

Function useBoolean

react/src/hooks.ts:411–421  ·  view source on GitHub ↗
(
  resource: Resource,
  propertyURL: string,
  opts?: useValueOptions,
)

Source from the content-addressed store, hash-verified

409
410/** Returns false if there is no value for this propertyURL. See {@link useValue} */
411export function useBoolean(
412 resource: Resource,
413 propertyURL: string,
414 opts?: useValueOptions,
415): [boolean | null, setValue] {
416 const [value, set] = useValue(resource, propertyURL, opts);
417 if (value == null) {
418 return [false, set];
419 }
420 return [valToBoolean(value), set];
421}
422
423/**
424 * Hook for getting a stringified representation of an Atom in a React

Callers 2

InputBooleanFunction · 0.90
InvitePageFunction · 0.90

Calls 2

valToBooleanFunction · 0.90
useValueFunction · 0.85

Tested by

no test coverage detected