Use RichTextField, but not have onChange event

default discord avatar
4 weeks ago


I am trying to use RichTextField in my own component, but I realize that there is no onChange event that I can use.

now I use in my component, like this:

import RichTextField from "payload/dist/admin/components/forms/field-types/RichText";
const customComponent = (props) => {
  // some code
  const [body, setBody] = useState(null)
  // some code
  return (
    <RichTextField name={"body"} path={"body"} defaultValue={body}></RichTextField>


I cannot handle the changes from the field and call setBody

Anyone has any idea on this? thanks

FYI, I use Payload 1.15, so it's SlateJS

solved by set rich text field with the same


prop as path in


, it will dispatch the value to that field

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!


    Connect with the Payload Community on Discord



    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.