When using the antd From form in the react tsx component, an error occurs when the parent component passes the value to the child component type definition.

When using the antd From form in the react tsx component, an error occurs when the parent component passes the value to the child component type definition.

Solution:
Introduce antd Form type declaration and inherit the interface of antd type declaration

import {
    
     FormComponentProps } from 'antd/lib/form';

interface MyProps extends FormComponentProps {
    
    
  text?: string;
}

const Son = (props: MyProps): JSX.Element => {
    
    
  return  <Form>...</Form>
  
const SonForm = Form.create<MyProps>({
    
     name: 'son_form' })(Son);

export default SonForm;

Guess you like

Origin blog.csdn.net/Cavin80/article/details/123688559