the Antd form component is rewritten with React Hooks. How do I get the value of the form? For example, TextareaItem component of antd-mobile, and
rewrite it with React Hooks. The semi-finished code is as follows:
import React, { useState, useEffect} from "react"
import { List, TextareaItem } from "antd-mobile";
import { createForm } from "rc-form";
function TextareaItemExample {
useEffect(() => {
//this.autoFocusInst.focus();
});
return (
<div>
<List renderHeader={() => "Customize to focus"}>
<TextareaItem
title="title"
placeholder="auto focus in Alipay client"
data-seed="logId"
ref={el => this.autoFocusInst = el}
autoHeight
/>
<TextareaItem
title="content"
placeholder="click the button below to focus"
data-seed="logId"
autoHeight
/>
</List>
</div>
);
}
const TextareaItemExampleWrapper = createForm()(TextareaItemExample);
export default TextareaItemExampleWrapper;
question:
1, how to get the value of the form? Get the value so that it can be used to send ajax requests. There is a custom Hook library react-use-form-state , but it is used for native html forms. How can you do the same thing on antd forms?
2. How should the statement this.autoFocusInst.focus ();
be written after the class component is changed to a function component?