swami swami - 5 months ago 56
React JSX Question

javascript jsx map on result of logical or

I want to have an expression like:

{phones.map((phone, j) =>

but phones array may not always be defined.

Is there something like this possible:

(phones || []).map()


you can check it like below,

const self = this;
   {phones !== undefined ? phones.map((phone, j) => 
   : null}