JSFiddle - React, Tailwind, and code Playground
by WoJWoJ
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
let cases = [{
critical: true,
hello: 'critical'
},
{
critical: false,
hello: 'not critical'
},
{
hello: 'not critical because no tag'
},
]
let showCritical = true
let showNonCritical = false
filteredCases = cases
.filter(x => !(!showCritical && x.critical))
.filter(x => !(!showNonCritical && !x.critical))
console.log(JSON.stringify(filteredCases))