Skip to main content
Subscribe to customer authentication state changes. The callback is called immediately with the current state, and then whenever the customer logs in, logs out, or their profile is updated.

Parameters

Returns

() => void - Unsubscribe function.

Examples

Update navigation

React-style hook pattern

Cart with customer association

Cleanup subscription

The callback is invoked immediately with the current state (which may be null if .init() hasn’t been called yet). This lets you set up your UI without checking initial state separately.