# Function useGetQueryRecommendations Beta

useGetQueryRecommendations(...args): UseGetQueryRecommendationsState

React hook that fetches recommended questions for a data model or perspective.

This hook includes the same code that fetches the initial suggested questions in the chatbot.

Note

This hook is currently under beta release for our managed cloud customers on version L2024.2 or above. It is subject to changes as we make fixes and improvements.

# Parameters

Parameter Type
...args [UseGetQueryRecommendationsParams]

# Returns

UseGetQueryRecommendationsState

An array of objects, each containing recommended question text and its corresponding JAQL

# Example

const { data, isLoading } = useGetQueryRecommendations({
  contextTitle: 'Sample ECommerce',
});

if (isLoading) {
  return <div>Loading recommendations</div>;
}

return (
  <ul>
    {data.map((item, index) => (
      <li key={index}>{item.nlqPrompt}</li>
    ))}
  </ul>
);