I am setting a state property as such: state = { sign: '' }
and set it to either '+'
or '-'
.
The plan is to then use this within a calculation. For example, imagine sign
is set to '+'
, I will use the operator in a calculation such as: 12 sign 8
. However, when I am outputting the result, I am getting 12+8
rather than 20
.
Any thoughts on where I am going wrong?