You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This won't work as written. Since obj is an empty object, the radio buttons in the group besides the one checked will have a value of undefined after this.setState(). The handler should be written as:
let obj = Object.assign(this.state.radioGroup) // prevents undefined
/* iterate through object and set all to false since only one radio
can be checked at a time.*/
for (const radio in obj) { obj[radio] = false }
obj[event.target.value] = true
this.setState({radioGroup: obj})
The text was updated successfully, but these errors were encountered:
Currently,
handleRadio(event)
looks like this:This won't work as written. Since
obj
is an empty object, the radio buttons in the group besides the one checked will have a value ofundefined
afterthis.setState()
. The handler should be written as:The text was updated successfully, but these errors were encountered: