JSFiddle - React, Tailwind, and code Playground

by maciejgurban

JavaScript

const OVERVIEW_ENABLED = true;
const IAP_ENABLED = false;

const arr = [
  OVERVIEW_ENABLED && {
    text: 'overview',
  },
  {
    text: 'foo',
  },
  IAP_ENABLED && {
    text: 'bar',
  },
].filter(truthy => truthy);

console.log(arr);