useRecipe
Hook to get a recipe
Parameters
Name | Type | Optional | Description |
---|---|---|---|
typeRef | string | False | The reference to the blueprint to retrieve a recipe for |
recipeName | string | True | Name of recipe to find (optional) |
dimensions | string | False | The recipes dimensions |
Returns
A list containing the blueprint document, a boolean representing the loading state, and an Error, if any.
Usage
Code example:
import { useRecipe } from '@development-framework/dm-core' const { recipe, isLoading, error} = useRecipe('someType', 'someRecipe') if (isLoading) return <div>Loading...</div> if (error) return <div>Error getting the recipe</div> if (recipe) { ... }