New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useDrop DropTargetHookSpec accept type should include a function type #2732
Comments
I know this isn't an ideal solution, but until this is solved and we can have target type-production functions, a workaround would be to use a |
I noticed this too, but got around it by using |
Just to echo this comment: I had a situation where I had a ternary that was rendering two versions of the same component based on a boolean. Clever react realized they are the same component but with different props. Although I tried to use this ternary to render them as independent nodes that mount/unmount based on the boolean, it was actually rerendering instead of remounting. Thus, the |
Really sorry, but I don't understand what to do, would it be possible to see an example/code snippet? |
So it turns out Updating to include the functionality is tricky for a few reasons:
The way The solution may be to either just update the docs to remove the mention of a function, or make it take a function that gets no arguments. In the latter, at least you can do |
Any update on it? We have the same problem, and using canDrop seems like a not-my-most-favrorite workaround |
Describe the bug
Your documentation of useDrop says that the specification object member
accept
is "A string, an ES6 symbol, an array of either, or a function that returns either of those, given component's props.".But in the code,
accept
is defined asTargetType
, which isstring | symbol
or an array of those.Expected behavior
accept
should be a type where a function which returnsTargetType
is possible.Additional context
I want to update
accept
dynamically. I thought this would be possible by changing theaccept
value ofuseDrop
but this doesn't work. I currently don't see how to do this otherwise and I can't find the behavior the documentation describes.The text was updated successfully, but these errors were encountered: