i have the following code here where i map data using map funtion the issue is that when
arrays are empty i get the flowing error
Cannot read properties of undefined (reading 'map')
i dont want error to occur
const Row = ([date, item], index) => { return ( <tr className="gradiantblur" key={date || index}> <td style={styles.tdFirst}>{date}</td> {columns.map((each, i) => ( <td key={i} style={styles.td}> {item.data && item.data[each] && item.data[each].map((itemByModule, id) => ( <span key={id}> {itemByModule.submodule} <br /> </span> ))} </td> ))} <td style={styles.td}> {item.customs && item.customs.map((each, i) => ( <span key={i}> {each.activity} <br /> </span> ))} </td> </tr> ); }; return ( <table style={{ width: "100%", borderCollapse: "collapse" }}> <thead style={{ borderBottom: "5px solid #5c0048" }}> <tr className="gradiantblur"> <th style={styles.th}>Dates</th> {columns.map((each) => ( <th style={styles.th} key={each}> {each} </th> ))} <th style={styles.th}>Custom</th> </tr> </thead> <tbody>{Object.entries(data).map(Row)}</tbody> </table> ); } show me some method where the ui displayes with out ging the error when there is no data

columnsare defined?