79180749

Date: 2024-11-12 10:44:03
Score: 0.5
Natty:
Report link

You should try doing this if you want to avoid the error and if the testData is really optional.

const myData = [
...(testData.length > 0 ? testData : []),
  {
    label: 'first',
    value: 'firstValue',
  },
  ...(isVisible ? [{ label: 'second', value: 'secondValue' }] : []),
];
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Hamza Murtaza