Skip to content

Commit

Permalink
refactor: avoid manipulating state directly
Browse files Browse the repository at this point in the history
  • Loading branch information
njdancer-am committed Nov 17, 2022
1 parent 107e2bb commit 6ca5853
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/ReactSlider/ReactSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,10 @@ class ReactSlider extends React.Component {
}

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

// Short circuit if the value is not changing
Expand Down

0 comments on commit 6ca5853

Please # to comment.