简体   繁体   English

如何将DragSource和Connect用于同一组件

[英]How can I use DragSource and Connect for a same component

I have a react component. 我有一个反应成分。 I want to use DragSource and Connect in the component. 我想在组件中使用DragSource和Connect。

export default connect(mapStateToProps, matchDispatchToProps)(ExpandableCard);
export default DragSource(Types.CARD, cardSource, collect)(ExpandableCard);

How can I accomodate both the lines for a single component ie ExpandableCard 如何容纳单个组件(即ExpandableCard)的两行

Connect "returns a new, connected component class, for you to use", so export default DragSource(Types.CARD, cardSource, collect)(connect(mapStateToProps, matchDispatchToProps)(ExpandableCard)); Connect “返回一个新的,已连接的组件类供您使用”,因此export default DragSource(Types.CARD, cardSource, collect)(connect(mapStateToProps, matchDispatchToProps)(ExpandableCard)); should do the trick? 应该做的把戏吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM