# Function useGetHierarchyModels Fusion Embed

useGetHierarchyModels(...args): HierarchyModelsState

React hook that retrieves existing hierarchy models from a Fusion instance.

# Parameters

Parameter Type
...args [GetHierarchyModelsParams]

# Returns

HierarchyModelsState

Load state that contains the status of the execution, the result hierarchy models, or the error if one has occurred

# Example

Retrieve the hierarchy models and render their counts.

 const { hierarchies, isLoading, isError } = useGetHierarchyModels({
   dataSource: DM.DataSource,
   dimension: DM.Commerce.AgeRange,
 });

 if (isLoading) {
   return <div>Loading...</div>;
 }
 if (isError) {
   return <div>Error</div>;
 }
 if (hierarchies) {
   return <div>{`Total Hierarchies: ${hierarchies.length}`}</div>;
 }
 return null;