TypeError: nameList.map is not a function by using antd validateFields()?

Everything worked well before i add validateFields()and rule, now i receive an errorTypeError: nameList.map is not a function, also i am trying to use async/awit, i am not sure why it happened, the previous code is working perfectly without validateFields() please someone help me.

  updateCategory = () => {
    //hide confirm box
    this.formRef.current.formRef.current.validateFields(async (err, values) => {
      if (!err) {
        this.setState({
          showStatus: 0,
        });
        const categoryId = this.category._id;
        const categoryName = this.formRef.current.formRef.current.getFieldValue(
          'categoryName',
        );
        //Reset fields to initialValues
        this.formRef.current.formRef.current.resetFields();
        //request to update category
        const result = await reqUpdateCategory({ categoryId, categoryName });
        if (result.status === 0) {
          //reload display list
          this.getCategorys();
        }
      }
    });
  };


Read more here: https://stackoverflow.com/questions/64399070/typeerror-namelist-map-is-not-a-function-by-using-antd-validatefields

Content Attribution

This content was originally published by Daniel Wang at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: