【发布时间】:2021-05-11 18:12:49
【问题描述】:
我正在按照教程进行操作,但我意外收到此错误,有人知道发生了什么吗?
这是完整的错误:
react_devtools_backend.js:2557 react-beautiful-dnd:设置问题是 遭遇。 > 不变式失败:provided.innerRef 尚未 提供了一个 HTMLElement。您可以找到有关使用 innerRef 的指南 回调函数 在:https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/guides/using-inner-ref.md
可放置代码:
render() {
const { column, clients } = this.props;
return (
<Container>
<Title>{column.name}</Title>
<Droppable droppableId={column.id}>
{(provided) => (
<TaskList
innerRef={provided.innerRef}
{...provided.droppableProps}
>
{clients.map((client, idx) => (
<Task
key={client.id}
client={client}
index={idx}
/>
))}
{provided.placeholder}
</TaskList>
)}
</Droppable>
</Container>
);
}
可拖动代码:
render() {
const { client, index } = this.props;
return (
<Draggable draggableId={client.id} index={index}>
{(provided) => (
<Container
innerRef={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
>
{client.name}
</Container>
)}
</Draggable>
);
}
谢谢!!!
【问题讨论】:
标签: reactjs react-component react-dnd react-beautiful-dnd