0
我想爲2個容器使用DND。React DND動態DropTarget由道具
1)容器有靜態數據表單axios =>任務列表。 2)容器只有設置給用戶的任務。
<Container id={1} list={this.props.tasks}/>
<Container id={2} list={this.state.userTasks}/>
當我改變用戶(通過選擇)X =>ÿ我必須刷新數據爲容器(2)。
我this.state.userTasks
是令人耳目一新,但子組件容器(2)仍然有相同的元素。
這是因爲我使用構造函數來傳遞數據。構造函數調用一次。我知道。
constructor(props) {
super(props);
this.state = {cards: props.list};
}
我不能使用componentWillReceiveProps(nextProps)
到集裝箱(孩子),因爲我只更新容器(2),當我從集裝箱移動元素集裝箱此方法調用(2)
如何在更改用戶時更新Container(2)卡?你有什麼想法?
? –