title: use ternary operator with useState in React Native
body: <p>I have a problem with ternary operator in my code</p>
  <ol>
  <li>I 2 states that holds true/false regarding whenever a button is pressed:</li>
  </ol>
  <p>Here(sorry i have a problem formatting it in block code)</p>
  <pre><code>const [lineChecked, setLineChecked] = useState(false);
  const [pieChecked, setPieChecked] = useState(false);
  </code></pre>
  <p>Here is the Touchable Opacity with onPress that i designated to turn 1 state to true, and other to false(i have 2 of this - the other one is the opposite):</p>
  <pre><code>&lt;TouchableOpacity
        onPress={() =&gt; {
          setPieChecked(true);
          setLineChecked(false);
        }}
      &gt;
  </code></pre>
  <p>What i want to accomplish is that when i press 1 touchable opacity graph X will be presented and when i press the other touchable opacity the other graph will be presented, initial state is that none of the graphs is presented.</p>
  <p>here is what i tried:</p>
  <pre><code> &lt;View style={styles.graphsPart}&gt;
      {lineChecked == &quot;true&quot; ? (
        &lt;LineChart
          data={data}
          width={screenWidth - 10}
          height={220}
          chartConfig={chartConfig}
          yAxisLabel=&quot;₪&quot;
        /&gt;
      ) : null}
      {pieChecked == &quot;true&quot; ? (
        &lt;LineChart
          data={dataTwo}
          width={screenWidth - 10}
          height={220}
          chartConfig={chartConfig}
          yAxisLabel=&quot;₪&quot;
        /&gt;
      ) : null}
    &lt;/View&gt;
  </code></pre>
  <p>Suggestions??</p>