0

I have a DragSource and DropTarget as children of parent

<Parent>
  <DragSource>
  <DropTarget>
</Parent>

How can I listen for isDragging prop of DragSource from parent?

sAs59
  • 562
  • 2
  • 7
  • 30

1 Answers1

2

One way would be to make both components connected components. From there when the DragSource component is dragged, dispatch an action that sets an isDragging property in the redux store to true.

The Parent component would then subscribe to the isDragging property in mapStateToProps.

Another method is to pass the isDragging function into the DragSource component from the Parent component as prop. That way when the DragSouce component is Dragged it calls isDragging within the parent component.

Nick
  • 616
  • 5
  • 19