无法理解为什么使用传播运算符

Cannot understand why spread operator is used

我正在使用 ngx-charts(Angular2+ 的图表库),我发现这行代码我不明白。

@Input() activeEntries: any[] = [];

/* ... */

/* Then, in a function */
this.activeEntries = [...this.activeEntries];

对我来说,没有任何影响。你知道这个用法和它的作用吗?

谢谢

通过传播数组文字中this.activeEntries的内容,此代码正在创建该数组的副本

然后将对该副本的引用分配回 this.activeEntries 覆盖原始引用。从上下文中不清楚为什么这是必要的。