
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis React error typically happens when you're accidentally trying to render a React component object directly instead of using JSX syntax. In the context of Sanity Studio custom components, this often occurs when working with custom input components for reference arrays.
Here are the most common causes and solutions:
Make sure you're returning JSX properly. The error suggests you might be returning a component reference instead of rendering it:
// ❌ WRONG - returns component object
const MyComponent = (props) => {
return props.renderDefault // This is the component itself
}
// ✅ CORRECT - renders the component
const MyComponent = (props) => {
return props.renderDefault(props) // Calling it with props
}renderDefault CorrectlyWhen customizing reference array inputs, make sure you're calling renderDefault as a function:
import { defineField } from 'sanity'
export default defineField({
name: 'myReferences',
type: 'array',
of: [{ type: 'reference', to: [{ type: 'someType' }] }],
components: {
input: (props) => {
// Do your custom logic here
// Then render the default component
return props.renderDefault(props) // ✅ Called as function
}
}
})If you're fetching data or using useFormValue to access other field values, make sure you're not accidentally returning a Promise:
import { useFormValue } from 'sanity'
import { useEffect, useState } from 'react'
const MyReferenceInput = (props) => {
const relatedField = useFormValue(['someOtherField'])
const [isReady, setIsReady] = useState(false)
useEffect(() => {
// Do async work
setIsReady(true)
}, [relatedField])
if (!isReady) return <div>Loading...</div>
return props.renderDefault(props) // ✅ Returns JSX
}When you say you "restructured it to match the other object," make sure your reference definition is correct:
{
name: 'myArray',
type: 'array',
of: [
{
type: 'reference',
to: [{ type: 'targetDocumentType' }]
// Not an object with a reference inside
}
]
}If you're registering a custom component, ensure you're passing the component correctly:
// ❌ WRONG
components: {
input: MyComponent() // Calling it
}
// ✅ CORRECT
components: {
input: MyComponent // Passing the component reference
}return props.renderDefault(props) and see if it worksThe "days later it crashes" behavior suggests you might have a conditional that sometimes returns the wrong type, or there's a race condition with async data. Focus on making sure every code path returns valid JSX, not component objects or Promises.
If you can share a minimal version of your custom component code, I can help pinpoint the exact issue!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store