Skip to main content

useRecipe

Hook to get a recipe

Parameters

NameTypeOptionalDescription
typeRefstringFalseThe reference to the blueprint to retrieve a recipe for
recipeNamestringTrueName of recipe to find (optional)
dimensionsstringFalseThe 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) {
  ...
}