Created
April 12, 2019 06:22
-
-
Save howtomakeaturn/f43c750bb5ddd0ca48a42f3f64f10d23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changeOptionValue(optionIndex, valueIndex, newValue) { | |
const state = this.state; | |
const newState = { | |
...state, | |
options: state.options.map((option, i) => | |
i === optionIndex ? | |
{ ...option, values: option.values.map((value, ii) => | |
ii === valueIndex ? | |
newValue : value | |
) | |
} : | |
option | |
) | |
}; | |
this.setState(newState) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment