-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Dynamically change hooks after first render #49
Comments
This behaviour is currently not supported:
-> The functions are passed onto a redux middleware at startup and not looked at again. This could be improved for sure. This looks like a valid use case. |
This should be fairly easy to do - we just need to move away from using a redux middleware and set up a subscription to the store within the |
I am fiddling with this while away :) |
This has now shipped @dashed. Enjoy! |
@alexreardon thanks for taking the time to look into this! 😄 I'll definitely check it out. |
I was playing with this library on a toy side-project, and I noticed I cannot dynamically change hooks, especially after the first render.
The gist of the code I had is as follows:
Even though the drag and drop (which is awesome by the way) appears to work fine, after the first render, the generated function from
onDragEnd(setCards)
is not replaced withinDragDropContext
.This is likely to do with the fact there is no
componentWillReceiveProps()
(or similar) atreact-beautiful-dnd/src/view/drag-drop-context/drag-drop-context.jsx
Lines 17 to 46 in 0f557e0
Even though the above example uses
recompose
, one may refactor the above to useredux
and friends (e.g.react-redux
), whereby the developer can passdispatch
(or a bindeddispatch
) toonDragEnd()
. You cannot really assumedispatch
won't change after the first render.The text was updated successfully, but these errors were encountered: