jeudi 18 février 2021

How to selectively render react table components?

In the given code snippet I dont want to render the component if the heading is equal to _id but the following conditional rendering results in no rendering at all (empty table). What conditional statement should I use?

return <table className='paleBlueRows' cellPadding= {11} cellSpacing={11}>
        <thead>
            <tr>{data[0] && columns.map((heading) => {
            if(heading!=='_id') <th>{heading}</th>
})}</tr> .....

Aucun commentaire:

Enregistrer un commentaire