I recently started to learn React Native and ran into this something which I am not quite sure about. I have multiple ways to solve the problem, but I believe if there is a solution to what I am asking, it may be helpful in the future.
The following is snippet of my code:
this.State = {
bedTime: 25,
breakfastTime: 5,
}
timer = timeType => {
this.setState({
timeType: this.state.timeType -1,
})
}
someFunction() {
this.timer(bedTime)
}
Now I could pass the parameter as string (ex. "bedTime") but then I'd have to make conditional statement in the function I am calling/passing. Can this problem be solved in the way I asked?
Thank you in advance :)