PineCone
PineCone

Reputation: 2343

Assignment to function parameter 'value' no-param-reassign

I am trying to get rid off the no-param-reassign error from the following code.

const changeHandler = ({ key, ref, value }): void => {
const properties = array.find((e) => e.key === key && e.color);
if (properties) {
  properties.color = value.hex; <<<<< this line throwing error. 
  saveAll();
}

};

Tried with adding the followings:

/* eslint-disable no-param-reassign */

my code ....
/* eslint-enable no-param-reassign */

 // eslint-disable-line no-param-reassign

Nothing has worked. Also tried creating a new variable and assign to it. Still didn't work. I can't commit code due to that error.

I need to update this (properties.color) array element with function parameter value.

Upvotes: 0

Views: 896

Answers (0)

Related Questions