I'm receiving the data where a lot of fields are null, and I have to populate something if the field is null.
like in the below data
{ //...
IGM_ETD: '2021-11-27T23:59:00+05:00',
milestatus: null,
transit_depart: null,
etd_atd: null,
// around 200+ fields
}
As here, the transit_depart is null, I'm using the ternary operator to put something in return if the data is null like this ;
// this is a reproducible example.
// there are some other styles and comp to display if/else part
{transit_depart ? <>{transit_depart}</> : <>Not Available<>}
This is working as expected but the problem is I have around 200+ fields like this and if I follow this then in the future if we have to make any UI change then we will be changing all the relevant code here. So how to avoid it or how can we can manage this.