Skip to content

watchUser

Watches for changes to the user in the client store and triggers the provided callback when a change is detected.

Import

import { watchUser } from "@account-kit/core";

Usage

import { watchUser } from "@account-kit/core";
// see createConfig for more information on how to create a config
import { config } from "./config";
 
watchUser(config)(console.log);

Parameters

config

AlchemyAccountsConfig the configuration containing the client store

Returns

(onChange: (user: User) => void) => (() => void) a function which accepts a callback that fires when the user changes and returns a function to unsubscribe from the user updates