<story><title>Why I&apos;m not a React Native developer</title><url>https://arielelkin.github.io/articles/why-im-not-a-react-native-developer.html</url></story><parent_chain><item><author>Rockslide</author><text>OK, this isn&amp;#x27;t really important for the quintessence of the article. But I&amp;#x27;m surprised again and again how many developers write code like&lt;p&gt;&lt;pre&gt;&lt;code&gt;  if (weAreConnected === true) {
      this.setState({
        isConnected: true
      })
    }
    else {
      this.setState({
        isConnected: false
      })
    }
  }
&lt;/code&gt;&lt;/pre&gt;
instead of&lt;p&gt;&lt;pre&gt;&lt;code&gt;  this.setState({
    isConnected: weAreConnected
  })&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain><comment><author>vmarsy</author><text>What if `weAreConnected` is `null` or `undefined`?&lt;p&gt;WalterSear&amp;#x27;s solution solves the issue since both `null` and `undefined` would become `false`:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    this.setState({
        isConnected: Boolean(weAreConnected)
    })

&lt;/code&gt;&lt;/pre&gt;
but in your case you could set `isConnected` to `null` or `undefined`&lt;p&gt;so if later in code someone makes the mistake of writing:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    if (this.state.isConnected === false) { &amp;#x2F;* do stuff *&amp;#x2F; }
&lt;/code&gt;&lt;/pre&gt;
they could have a bad surprise.</text></comment>
<story><title>Why I&apos;m not a React Native developer</title><url>https://arielelkin.github.io/articles/why-im-not-a-react-native-developer.html</url></story><parent_chain><item><author>Rockslide</author><text>OK, this isn&amp;#x27;t really important for the quintessence of the article. But I&amp;#x27;m surprised again and again how many developers write code like&lt;p&gt;&lt;pre&gt;&lt;code&gt;  if (weAreConnected === true) {
      this.setState({
        isConnected: true
      })
    }
    else {
      this.setState({
        isConnected: false
      })
    }
  }
&lt;/code&gt;&lt;/pre&gt;
instead of&lt;p&gt;&lt;pre&gt;&lt;code&gt;  this.setState({
    isConnected: weAreConnected
  })&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain><comment><author>WalterSear</author><text>Or&lt;p&gt;&lt;pre&gt;&lt;code&gt;  this.setState({
    isConnected: Boolean(weAreConnected)
  })
&lt;/code&gt;&lt;/pre&gt;
If you want to be super obvious, and aren&amp;#x27;t using a type system.</text></comment>