首页 > 解决方案 > 警告:道具类型失败:提供给“编辑器”的“对象”类型的无效道具“值”,应为“字符串”

问题描述

<Form
  form={form}
  initialValues={{
  content: postDetail.content,
  }}
  onFinish={onFinish}
>
   <Form.Item name="content">
     <Editor onEditorChange={handleEditorChange} init={INIT} />
   </Form.Item>
        
   <Form.Item>
     <StyledButton htmlType="submit" type="primary" height={45} width={240}>
         Submit
     </StyledButton>
   </Form.Item>
</Form>

我使用tinymce编辑器结合antd设计的形式来创建一个创建帖子页面。当我加载页面并在编辑器中更改一些文本时,调试器会显示如下代码所示的警告。我如何解决它:

 Warning: Failed prop type: Invalid prop `value` of type `object` supplied to `Editor`, expected `string`.
    in Editor (at CreateForm/index.jsx:151)
    in Field (created by WrapperField)
    in WrapperField (created by FormItem)
    in FormItem (at CreateForm/index.jsx:150)
    in div (created by styled.div)
    in styled.div (at CreateForm/index.jsx:138)
    in div (created by Context.Consumer)
    in Col (at CreateForm/index.jsx:137)
    in div (created by Context.Consumer)

标签: reactjstinymceantd

解决方案


推荐阅读