Using an item in an array in a condition statement
<p>I have an array of modals in my redux store that looks like this:</p>

<pre><code>modals: [
        {id: "modal1", isDisplayed: false},
        {id: "modal2", isDisplayed: true}
    ]
</code></pre>

<p>In my React component, I want to have simple condition statements to display or not display my modals. I'm having a bit of trouble setting my condition statements right.</p>

<pre><code>{this.props.modals["modal1"].isDisplayed ? &lt;Modal1 /&gt; : null}
{this.props.modals["modal2"].isDisplayed ? &lt;Modal2 /&gt; : null}
</code></pre>

<p>What's the right syntax to check the isDisplayed property of a given modal in my modals array?</p>