What if `weAreConnected` is `null` or `undefined`?
WalterSear's solution solves the issue since both `null` and `undefined` would become `false`:
this.setState({
isConnected: Boolean(weAreConnected)
})
but in your case you could set `isConnected` to `null` or `undefined`so if later in code someone makes the mistake of writing:
if (this.state.isConnected === false) { /* do stuff */ }
they could have a bad surprise.