New in 1.44.0 (BETA)

useDataScope(dataClassName)

Returns the closest DataScope from the current data.

Current data is mostly set automatically by the SDK, based on the particular structure and DataLocators of the content in question, but it can also be provided using the Scrivito.ContentTag component with a dataContext prop.

Params

dataClassName (String) – Optional data class name. If the class name is specified, then the current data is searched for the first scope with the given class name.

Returns

DataScope or undefined – The closest DataScope from the current data. If the class name is given, then the current data is searched for the first scope with the given class name. If no current data is available, or if the current data contains no data scopes (i.e. only data items), undefined is returned.