React.docschina.org/docs/hooks-… The official documentation

UseState is equivalent to class xx extends Component

import React, { useState } from 'react';
// Declare a count variable, starting with 0. Update count by setCount()
const [count, setCount] = useState(0);
Copy the code

2. UseEffect is equivalent to the lifecycle

3. useRef

import React, { useRef } from 'react';
const searchFormRef = useRef();

// Get the search criteria
const getSearchFormValue = () = > {
    const {
      form: { getFieldsValue },
    } = searchFormRef.current.props;
    return getFieldsValue();
};

const { keyword, areaName } = getSearchFormValue();
Copy the code