0
我有一個組件可以維護一個狀態中的對象列表。我打算讓這個組件成爲一個Drag Source。當Drag事件開始時,我希望拖動組件狀態中的對象列表。 問題是Drag Source Spec對象的方法beginDrag將組件的prop作爲參數。這意味着可以拖動的對象必須從道具派生。如何訪問DragSource規範中的組件狀態
draggedItemSpec {
beginDrag(props, monitor, connect)
{
/*how do I access component state here?
Why there is a limitation that when creating dragged object, you should only use props?*/
}
}