useChanges

useChanges<T>(
    changeQuery: IChangeQuery,
    options?: ChangesOptions,
    deps?: any[]): T[] | null | undefined;

Returns web or list change collection. Use ChangesOptions.list property to get list changes instead of web changes.

Examples

Get web changes,

const changeQuery = {
    Add:true,
    Alert:true,
    ChangeTokenEnd: { StringValue: "some end token string" },
    ChangeTokenStart: { StringValue: "some start token string" }
};

const webChanges = useChanges(myQuery, undefined, [
    myQuery?.ChangeTokenStart?.StringValue,
    myQuery?.ChangeTokenEnd?.StringValue
]);

Get list changes by using list title and UUID,

const listChangeQuery = {
    Add:true,
    Update:true,
    Delete:true,
    ChangeTokenEnd: { StringValue: "some end token string" },
    ChangeTokenStart: { StringValue: "some start token string" }
};

// getting list changes by list title
const listChanges = useChanges(
	listChangeQuery,
	{ list: "My List Title" },
	[
		myQuery?.ChangeTokenStart?.StringValue,
		myQuery?.ChangeTokenEnd?.StringValue
	]
);

// getting list changes by list Id
const anotherListChanges = useChanges(
	listChangeQuery,
	{ list: "61ca5ff8-f553-4d51-a761-89225b069a4f" }, 
	[
	    myQuery?.ChangeTokenStart?.StringValue,
	    myQuery?.ChangeTokenEnd?.StringValue
	]
);

Parameters

NameTypeDescriptionTracked for changes
changeQueryIChangeQueryChange query objectNo
options?ChangesOptionsuseChanges hook optionsPartially
deps?DependencyListHook dependency listYes