useListItem

useListItem<T>(
	itemId: number,
	list: string,
	options?: listItemOptions,
	deps?: any[]): T | null | undefined;

Returns an item from specified list.

Examples

Get a list item,

const item = useListItem(10, "5ee53613-bc0f-4b2a-9904-b21afd8431a7");

Get a list item with query and custom type,

export interface MyItem {
	Id: number;
	Title: string;
	Created: string;
	Modified: string;
	Author : {
		Title: string;
	}
}

const myItem = useListItem<MyItem>(10, "My List Title", {
	query: {
		select: ["Title", "Id", "Author/Title", "Created", "Modified"],
		expand: ["Author"]
	}
});

Parameters

NameTypeDescriptionTracked for changes
itemIdnumberItem IdYes
liststringList UUID or titleYes
options?ListItemOptionsuseListItem hook optionsPartially
deps?DependencyListHook dependency list.Yes