use Object.assign to always ensure setState receives a new value object

This commit is contained in:
Kyle Shockey
2018-04-20 15:59:46 -07:00
parent 1be0a6df60
commit f23be7d8f5
@@ -33,12 +33,10 @@ export default class HttpAuth extends React.Component {
let { onChange } = this.props
let { value, name } = e.target
let newValue = this.state.value || {}
let newValue = Object.assign({}, this.state.value)
if(name) {
newValue[name] = value
if(newValue.set) {
newValue = newValue.set(name, value)
}
} else {
newValue = value
}