Reference / @getenginex/sdk-react / useUserKey
useUserKey()
useUserKey(
namespace?,method?): readonlyunknown[] |null
Prefix of the current session user's keys, to invalidate or read from the cache: null without a session. For the exact setQueryData key, use the factory's (q.wallet.getBalance().queryKey).
Parameters
namespace?
string
Namespace, e.g. 'wallet'.
method?
string
Method, e.g. 'getBalance' (only with namespace).
Returns
readonly unknown[] | null
['enginex', 'user', userId, namespace?, method?], or null without a session.
Throws
If called outside an EnginexProvider.
Example
ts
const walletKey = useUserKey('wallet')
if (walletKey) queryClient.invalidateQueries({ queryKey: walletKey })