Backstage
    Preparing search index...
    • A hook that simplifies the consumption of a versioned contexts that's stored inside a global singleton.

      Type Parameters

      • Versions extends { [key: number]: unknown }

      Parameters

      • key: string

        A key that uniquely identifies the context.

      Returns VersionedValue<Versions> | undefined

      const versionedHolder = useVersionedContext<{ 1: string }>('my-context');

      if (!versionedHolder) {
      throw new Error('My context is not available!')
      }

      const myValue = versionedHolder.atVersion(1);

      // ...