[英]Intellij WebStorm showing useless usage search on encapsulated React components (using HOC)
It is basically this issue .基本上就是这个问题。
While using code like在使用代码时
class SomeComponent extends React.Component {
}
export default withRouter(SomeComponent);
I can't use search usages properly, because it obviously finds the export line.我无法正确使用搜索用法,因为它显然找到了导出行。
It can be hacked in functional components like this:它可以在功能组件中被黑客入侵,如下所示:
const SomeComponent = withRouter((props) => {
//...component here
});
export default SomeComponent;
but gets very ugly when using redux for example:但是在使用 redux 时变得非常难看,例如:
const mapStateToProps = (state, ownProps) => ({
....
});
const SomeComponent = connect(mapStateToProps)({
cartPhotos,
digitals,
balancePrice,
photolabPrice,
digitalsPrice,
voucher,
photosPrice,
deliveryPrice,
totalPrice,
openPhotolabModal,
isSidebar,
}) => {
});
export default SomeComponent;
My questions are:我的问题是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.