useUser

useUser(
	userId: string | number,
	options?: UserOptions,
	deps?: any[]): ISiteUserInfo | null | undefined;

Returns an user from site user collection.

Examples

Get site user by Id,

const userById = useUser(27);

Get site user by email,

const userByEmail = useUser("user@example.onmicrosoft.com");

Get site user by login name,

const userByLoginName = useUser("i:0#.f|membership|user@example.onmicrosoft.com");

Query site user properties,

const userById = useUser(27, {
	query: {
		select: ["Id", "Title", "LoginName"]
	}
});

Parameters

NameTypeDescriptionTracked for changes
userstring | numberUser Id, login name or emailYes
options?UserOptionsuseApps hook optionsPartially
deps?DependencyListHook dependency list.Yes