useCurrentUser

useCurrentUser(
  options?: CurrentUserInfoOptions, 
  deps?: any[]): ISiteUserInfo | null | undefined;

Returns current user information.

Examples

Get basic user properties,

const userAllProps = useCurrentUser();

Get user properties with query,

const user = useCurrentUser({
  query: {
    select: ["Title", "Id", "LoginName"]
  }
});

Parameters

NameTypeDescriptionTracked for changes
options?CurrentUserInfoOptionsuseCurrentUser hook options.Partially
deps?DependencyListHook dependency listYes