Components
CraftArea
Learn how to use the CraftArea component.
The CraftArea
component renders the mapped React component based on your queried data and the contentMapping.components
property in your craftInit()
configuration.
Note
You can read more about configuring components in the configuration docs.
import { CraftArea } from '@query-api/next'
import { CraftPageHome } from '@/types/base'
export default function Home(props: CraftPageHome) {
return (
<div>
<CraftArea content={props.contentBuilder} />
</div>
)
}
content
: The queried data from Craft CMS. This should be an array of objects containing the block types and their corresponding data.
Usage
Typically the CraftArea
component is used within a Next.js page to render matrix blocks.
Note
If you are curious how to set this up, you can have a look into the quick start guide.