Skip to content

Commit 6ca5853

Browse files
committed
refactor: avoid manipulating state directly
1 parent 107e2bb commit 6ca5853

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/ReactSlider/ReactSlider.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,10 @@ class ReactSlider extends React.Component {
836836
}
837837

838838
move(newValue) {
839-
const { index, value } = this.state;
839+
// Clone this.state.value since we'll modify it temporarily
840+
// eslint-disable-next-line zillow/react/no-access-state-in-setstate
841+
const value = this.state.value.slice();
842+
const { index } = this.state;
840843
const { length } = value;
841844

842845
// Short circuit if the value is not changing

0 commit comments

Comments
 (0)