代码之家  ›  专栏  ›  技术社区  ›  Čamo

×InvalidCharacterError:在“Document”上执行“createElement”失败:提供的标记名(“”)不是有效名称

  •  1
  • Čamo  · 技术社区  · 4 年前

    我在react应用程序中出现了一个错误,但几个小时后我找不到错误。应用程序仅在某些页面上工作,这给我带来了以下错误: InvalidCharacterError:在“Document”上执行“createElement”失败:提供的标记名(“”)不是有效名称。 以下是错误日志中提到的呈现方法的PageDetail.tsx行685的代码:

      public render(): React.ReactNode {
        return (
          <FormWithReduxPage
            setItem={this.props.pageDetailSetItem}
            pageTitle={i18n.t("pages.page.detail.pageTitle")}
            pageSubtitle={i18n.t("pages.page.detail.pageSubtitle")}
            spreadScreenState="page"
            apiUrlPrefix={"page" + "/" + this.props.match.params.lang}
            validator={PageValidator}
            onItemLoaded={this.checkFileTemplateIndex}
            emptyItem={emptyPage}
            id={this.props.match.params.id}
          >
            {(p) => (
              <Page
                {...p}
                removeDynamicDataField={this.removeDynamicDataField}
                show={this.state.showAddRow}
                closeAdd={this.closeAddRow}
                showEditRow={this.openAddRow}
                saveData={this.insertNewDynamicRow}
                dynamicEditedItem={this.state.dynamicEditedItem}
                updatedItem={this.state.updatedItem}
                setEditedItem={this.startEditItem}
                setUpdatedItem={this.updateEditedItem}
                stopEditing={this.saveEditedItem}
                changeLang={this.changeLanguage}
              />
            )}
          </FormWithReduxPage>
        );
      }
    

    这是控制台日志。

    The above error occurred in one of your React components:
    in Unknown (at FormWithRedux.tsx:293)
    in FormWithReduxPage (at PageDetail.tsx:685)
    in PageDetailComponent (created by Context.Consumer)
    in Connect(PageDetailComponent) (created by Route)
    in Route (at Auth.tsx:557)
    in Switch (at Auth.tsx:554)
    in div (at Auth.tsx:553)
    in main (at Auth.tsx:383)
    in div (at Auth.tsx:381)
    in div (at Auth.tsx:380)
    in Page (at Auth.tsx:696)
    in AuthComponent (created by Context.Consumer)
    in Connect(AuthComponent) (created by Route)
    in Route (created by withRouter(Connect(AuthComponent)))
    in withRouter(Connect(AuthComponent)) (at App.tsx:126)
    in div (at App.tsx:122)
    in div (at App.tsx:63)
    in Router (at App.tsx:62)
    in I18nextProvider (at App.tsx:61)
    in AdminApp (created by Context.Consumer)
    in Connect(AdminApp) (at src/index.tsx:11)
    in Provider (at src/index.tsx:10)
    

    这是截图 enter image description here

    有人能帮我修一下吗?谢谢。

    0 回复  |  直到 4 年前