Skip to content
Advertisement

Changing an object value from a Class

I have a js file handling my css where I am trying to change the value of an object, but the value stays the same.

JavaScript
JavaScript

I assume the “this.opacity” is only returning a reference and not modifying the actual object and I am unsure of how to make this object mutable.

How would I go about changing this value?

Advertisement

Answer

You should save a clicked state in the state and set opacity depending on it.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement