Hello, while troubleshooting I found [this old article](
https://payloadcms.com/blog/building-a-custom-field) that is no longer relevant but shows what I believe should be happening.
For objects of type Field you can specify an admin attribute and then a custom component (see screenshot). Based on the article it looks like React components were previously allowed but now I have trouble finding any documentation on what the alternative type should be. Digging into the code wasn't super helpful to me 😦 any ideas?
RenderSubmissionAsForm is a tsx file?
yes 🙂
Can you post the component here
Also, to confirm, this is v2 or v3?
This is the base example for a custom field component
import { useField } from 'payload/components/forms'
const CustomTextField: React.FC<{ path: string }> = ({ path }) => {
const { value, setValue } = useField<string>({ path })
return <input onChange={(e) => setValue(e.target.value)} value={value} />
}This is v3
So this is a client component or server component?
Even if I copy + paste that component the same type error appears 🤔
How about
'use client'
import React, { useState } from 'react'
export const MyClientComponent: React.FC = () => {
const [count, setCount] = useState(0)
return (
<button onClick={() => setCount(count + 1)}>
Clicked {count} times
</button>
)
}Take a look at the release notes for v3 beta 79. How you include custom components has changed.
Nice find
@1063099015589273630Thank you both 🙂
Star
Discord
online
Get dedicated engineering support directly from the Payload team.