什么是...
做这个阵营(使用JSX)代码,什么是它叫什么名字?
<Modal {...this.props} title='Modal heading' animation={false}>
Run Code Online (Sandbox Code Playgroud) 我在一些示例代码中遇到了这个,我完全迷失了.
const addCounter = (list) => {
return [...list, 0]; // This is the bit I am lost on, and I don't know about [...list, 0]
}
Run Code Online (Sandbox Code Playgroud)
显然以上等于以下内容:
const addCounter = (list) => {
return list.concat([0]);
}
Run Code Online (Sandbox Code Playgroud)
任何建议或解释都非常感谢.
我遇到了我应该使用的代码问题.我找到了一个我不熟悉的语法,我在google文档时遇到了麻烦:
export const Something = class Something {
constructor(someObject = {}) {
this.someObject = {...Something.someObjectDefaultAsStaticMethod,...someThing};
};
// The rest of the class
};
Run Code Online (Sandbox Code Playgroud)
我在理解参数前面的三个点(...)时遇到了问题.而"参数javascript中的点"是一个糟糕的搜索词.有人可以帮助我,也许告诉我这个语法实际上是什么调用,或者直接将我链接到文档?