title: Condition inside a json array of objects
body: <p>I am using a library called <code>chartjs</code> to print the graphics on my screen. For that, I am passing an array of objects that should be displayed in this graph. The problem is that I just want that last object to appear if the <code>state</code> is equal to <code>'yes</code>'. If I remove this conditional, the code works perfectly. Any suggestions on how I could solve this problem?</p>
  <pre><code>[
         {
            data1: 'mydata01',
            data2: 'mydata02',
         },
         {
            data3: 'mydata03',
            data4: 'mydata04',
         },
      this.state.condition === 'yes' ? (
         {
            data3: 'mydata03',
            data4: 'mydata04',
         },
        ) : 'remove'
      ]
  </code></pre>