JSFiddle - React, Tailwind, and code Playground

HTML

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.11.4/datatables.min.css"/>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
        </head>
        <title>Test</title>
<body>

<table id="example" class="display" style="width:100%">
    <thead>
        <tr>
            <th>Name</th>
            <th >Position</th>
            <th>Office</th>
            <th class ="invis">Age</th>
            <th class ="invis">Age2</th>
            <th>Start date</th>
            <th>Salary</th>
        </tr>
        
    </thead>
    <tbody>
        <tr>
            <td>Tiger Nixon</td>
            <td>System Architect</td>
            <td>Edinburgh</td>
            <td>0</td>
            <td>0</td>
            <td>2011/04/25</td>
            <td>$320,800</td>
        </tr>
        <tr>
            <td>Garrett Winters</td>
            <td>Accountant</td>
            <td>Tokyo</td>
            <td>25</td>
            <td>0</td>
            <td>2011/07/25</td>
            <td>$170,750</td>
        </tr>
        <tr>
            <td>Ashton Cox</td>
            <td>Junior Technical Author</td>
            <td>San Francisco</td>
            <td>13</td>
            <td>0</td>
            <td>2009/01/12</td>
            <td>$86,000</td>
        </tr>
        <tr>
            <td>Cedric Kelly</td>
            <td>Senior Javascript Developer</td>
            <td>Edinburgh</td>
            <td>31</td>
            <td>0</td>
            <td>2012/03/29</td>
            <td>$433,060</td>
        </tr>
        <tr>
            <td>Airi Satou</td>
            <td>Accountant</td>
            <td>Tokyo</td>
            <td>22</td>
            <td>0</td>
            <td>2008/11/28</td>
            <td>$162,700</td>
        </tr>
        <tr>
            <td>Brielle...

JavaScript

$(document).ready(function() {
    $('#example').DataTable( {
        "columnDefs": [
            {
                // The `data` parameter refers to the data for the cell (defined by the
                // `data` option, which defaults to the column being worked with, in
                // this case `data: 0`.
                "targets": 'invis',
                /*
                "render": function ( data, type, row ) {
                    if(data == 41){
                    	this.visible = false
                    }
                },
                */
                
            }
        ],
        initComplete: function () {
        	var api= this.api();
        	
          var ages = api.column(4).data().toArray();

					if ( ages.every( (val, i, arr) => val === ages[0] ) ) {
          	api.column( 4 ).visible( false );
          } else {
          	api.column(4).visible(true);
          }
        
        }
    } );
} );