Reputation: 669
I have a redux wrapper that I'm using to work with a next.js app. How do I combine compose with this type of wrapper?
export default withRedux(initStore, null, mapDispatchToProps)(App)
and
export default compose(
connect(mapStateToProps, mapDispatchToProps),
DropTarget(NativeTypes.FILE, dustbinTarget, (connect, monitor) => ({
connectDropTarget: connect.dropTarget(),
isOver: monitor.isOver(),
canDrop: monitor.canDrop(),
}))
)(DustBin);
Upvotes: 0
Views: 180
Reputation: 22696
If your wrapper adheres to the standard HOC convention (ie. a function returning an enriched composed component), all you have to do is:
export default compose(
withRedux(initStore, null, mapDispatchToProps),
DropTarget(NativeTypes.FILE, dustbinTarget, (connect, monitor) => ({
connectDropTarget: connect.dropTarget(),
isOver: monitor.isOver(),
canDrop: monitor.canDrop(),
}))
)(DustBin);
Upvotes: 1