Dealing with null values from Rest call in React/SPF

Iron Contributor

Hello,

 

Apologies if this is the wrong forum, please correct me if so.

 

Am trying to get my head around using React in SharePoint Framework Dev. So far I'm surviving. But bit stuck now. Am making a Rest call to get SharePoint list data, including various lookups. I can get the data, including lookup values. However, for some of the lookups I get a null value (where a member of staff has not been assigned to a call for instance) and my results are not rendered as the code cannot find a value (cos it's null).

 

My question is, at what point should I be dealing with the null and how? I get json back initially, and then I turn that into an object array. I then pass it as props to my component and map it to my data model. At what stage of that process should I be checking for null values and manipulating them? If that is what I should be doing... 

 

Any suggestions much appreciated.

 

Paul

0 Replies