Skip to content

useUiConfig

Custom hook to manage and update the UI configuration. This hook retrieves the UI config from the context, syncs it with the local state, and updates it if necessary. NOTE: this hook is mainly meant to be used internally, but provides utility if you need your UI config to be dynamic

Import

import { useUiConfig } from "@account-kit/react";

Usage

import {
  createConfig,
  useUiConfig,
  DEFAULT_UI_CONFIG,
} from "@account-kit/react";
import { sepolia } from "@account-kit/infra";
 
const config = createConfig(
  {
    apiKey: "you-api-key",
    chain: sepolia,
  },
  DEFAULT_UI_CONFIG
);
 
// somewhere in a component...
 
const { updateConfig, ...uiConfig } = useUiConfig();

Returns

AlchemyAccountsUIConfigWithDefaults & {updateConfig: (partial: AlchemyAccountsUIConfig) => void} the configuration object along with an update function