[英]Delete index using rest/spread operator using JS
I have the following scenario where I need an index deleted. 我在以下情况下需要删除索引。
JS: JS:
this.state = {
rangeValue: this.props.rangeSlider && [
this.props.rangeValue[0],
this.props.rangeValue[1],
this.props.rangeValue[2]
],
};
<Range
defaultValue={
this.props.rangeValue[2] ? [...this.state.rangeValue] : [...this.state.rangeValue] //minus last index in my array (this.props.rangeValue[2])
}
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.