When I attempt to format the data being received from TableData I keep getting an error Cannot read properties of undefined (reading ‘replace’). This happens when I reload the page after trying to filter the data I have put a comment in the code to show the line that when i refresh and add the code it gives me the error.
function ShiftViewTable({ tableData }) {
const checkMobile = useCheckMobileScreen();
console.log(checkMobile);
const handleDetailsView = (props) => {
return (
<Link className="details-link" to={`/${props.data._id}`}>
{Moment(props.value).format("MMMM-DD-YYYY")}
</Link>
);
};
const [colDefs, setColDefs] = useState([
{ field: "date", cellRenderer: handleDetailsView },
{ field: "log_name" },
{
field: "critical_updates",
flex: 2,
valueFormatter: (text) => text.value.replace(/<[^>]*>/g, ""), **//when i refresh the page with this it says the error**
},
{ field: "ticket_updates", flex: 2 },
]);
Anyway I try to filter data after retrieving from backend I get this type of error.
New contributor
Tyler Noller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.