Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 类型';空';不可分配给类型';元素';。ts(2345)_Jquery_Reactjs_Typescript - Fatal编程技术网

Jquery 类型';空';不可分配给类型';元素';。ts(2345)

Jquery 类型';空';不可分配给类型';元素';。ts(2345),jquery,reactjs,typescript,Jquery,Reactjs,Typescript,我得到以下错误: “FunctionComponent>&{WrappedComponent:ComponentType;}”类型的参数不能分配给“WrappedComponent>>”类型的参数。 类型“FunctionComponent>&{WrappedComponent:ComponentType;}”不能分配给类型“WrappedComponentFactory>>”。 类型'ReactElement ReactElement Component)>| null)|(新(道具:any)

我得到以下错误:

“FunctionComponent>&{WrappedComponent:ComponentType;}”类型的参数不能分配给“WrappedComponent>>”类型的参数。 类型“FunctionComponent>&{WrappedComponent:ComponentType;}”不能分配给类型“WrappedComponentFactory>>”。 类型'ReactElement ReactElement Component)>| null)|(新(道具:any)=>Component)>|null'不可分配给类型'Element'。 类型“null”不可分配给类型“Element”。ts(2345)

我正试图用
resact-sortable-hoc
中的
SortableContainer
包装我的列表并将其导出。我的组成部分是:

class SortContainer extends React.Component<{ intl: IntlShape } & ISortContainerProps, {}> {

  public render() {

    ...

    return (
      <Row className={style.sortableList}>
        <List striped>
          <List.Header
            name={formatMessage(messages.detailsType)}
            width={2}
          />
          ...
          {
            items &&
            !!items.length &&
            items.map((item, index) => {
              return (
                <React.Fragment key={`detailsRowId__${index}`}>
                ...
                </React.Fragment>
              );
            })
          }
        </List>
      </Row>
    );
  }
}

export default
  SortableContainer(
    injectIntl(
      observer(SortContainer)
    )
  );
类SortContainer扩展React.Component{
公共渲染(){
...
返回(
...
{
项目&&
!!项目长度&&
items.map((项目,索引)=>{
返回(
...
);
})
}
);
}
}
导出默认值
可分拣集装箱(
注射剂(
观察员(SortContainer)
)
);

为什么不在不使用HOC SortableContainer的情况下导出列表,然后将其包装在使用位置,如中所示

然后在调用者组件中:

const SortableList = SortableContainer<any>(({ children }) => <div>{children}</div>);
const SortableList=SortableContainer(({children})=>{children});
这样称呼它:

<SortableList onSortEnd={this.onSortEnd}>
    <SortContainer
        ...
    />
</SortableList>

<SortableList onSortEnd={this.onSortEnd}>
    <SortContainer
        ...
    />
</SortableList>