I am using react-dnd and most of their internal functions take component
as a parameter so we can determine the components size and stuff in that function. Component
provides a reference to the component itself so we can do stuff like getDOMNode(component).getWhatever()
.
However, the function canDrop
does not receive this parameter unfortunately.
I am trying to use the component parameter to determine the position inside of the canDrop
function. Since I cannot use the component parameter the docs recommend:
component: When specified, it is the instance of your component. Use it to access the underlying DOM node for position or size measurements, or to call setState, and other component methods. It is purposefully missing from canDrop because the instance may not be available by the time it is called. If you want this method to depend on the component's state, consider lifting the state to the parent component, so that you can just use props. Generally your code will be cleaner if you rely on props instead whenever possible.
I'm not sure how to go about lifting the component itself to its parent so that I can pass it as props back down to itself. Can you give me an example where something like this is happening?