@frak-labs/components
Version:
Frak Wallet components, helping any person to interact with the Frak wallet.
18 lines (17 loc) • 767 B
JavaScript
import { a as subscribeSdkConfig } from "./usePlacement-Bpo25qjA.js";
import { sdkConfigStore } from "@frak-labs/core-sdk";
import { useSyncExternalStore } from "preact/compat";
//#region src/hooks/useGlobalComponents.ts
/**
* Subscribe to the global component defaults from the SDK config store.
* These serve as fallbacks when no placement-level override exists.
*
* Backed by `useSyncExternalStore`: the snapshot is the stored `components`
* object reference (stable between `frak:config` dispatches), so the component
* only re-renders when the global components actually change.
*/
function useGlobalComponents() {
return useSyncExternalStore(subscribeSdkConfig, () => sdkConfigStore.getConfig().components);
}
//#endregion
export { useGlobalComponents as t };