【发布时间】:2015-11-26 14:08:00
【问题描述】:
我正在阅读an example of the React-dnd project:
moveCard(dragIndex, hoverIndex) {
const { cards } = this.state;
const dragCard = cards[dragIndex];
this.setState(update(this.state, {
cards: {
$splice: [
[dragIndex, 1],
[hoverIndex, 0, dragCard]
]
}
}));}
这个 $splice 和 on this page 解释的一样吗?
谁能解释这段代码的作用? $splice 函数让我很困惑。
【问题讨论】: