Change text colour depending on if condition react
<p>I want to use something similar to <code>getElementById</code> in order to select my element and change the text colour. I currently have a unordered list, and wish to change the colour of each individual depending on an if condition. </p>

<pre><code>&lt;div style={styles.passwordRules}&gt;
  &lt;ul style={styles.listOne}&gt;
    &lt;li style={styles.li}&gt;&lt;span style={styles.error} id="test"&gt;8 a 16 caratteri&lt;/span&gt;&lt;/li&gt;
    &lt;li style={styles.li}&gt;&lt;span style={styles.fontNormal}&gt;Carattere maiuscolo&lt;/span&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;ul style={styles.listTwo}&gt;
    &lt;li style={styles.li}&gt;&lt;span style={styles.fontNormal}&gt;Un numero&lt;/span&gt;&lt;/li&gt;
    &lt;li style={styles.li}&gt;&lt;span style={styles.fontNormal}&gt;Carattere minuscolo&lt;/span&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;ul style={styles.listThree}&gt;
    &lt;li style={styles.li}&gt;&lt;span style={styles.fontLink}&gt;Nessuna informazione personale&lt;/span&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>Meaning that for instance, I would like something similar to this:</p>

<pre><code>if(text === 'foo') {
//change colour to grey
}
</code></pre>

<p><strong>Please note, I cannot use</strong> <code>getElementById</code></p>