简体   繁体   English

Javascript function 参数中的复杂解构

[英]Javascript complex destructuring in function argument

I am confused seeing a syntax somewhere in my React code as below.我很困惑在我的 React 代码中的某处看到如下语法。 Assuming there is some destructuring going on here.假设这里正在进行一些解构。 Would that be correct?那会是正确的吗?

function xyz ({param1, data: {response, error, classes}, param3}) {

}

Yes destructuring is happening, it may be useful at certain points, but it is better to separate the inputs of the function or use another function for example as params.是的,正在发生解构,它可能在某些点有用,但最好将 function 的输入分开或使用另一个 function 作为参数。

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

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