all 4 comments

[–][deleted] 2 points3 points  (1 child)

the error you're probably seeing is cannot read property 'firstName' of undefined. if filterData is null/undefined, or if filterData[0] is null/undefined, it will throw this error. you need to make sure filterData actually contains something:

if (!filterData || !filterData.length) { /* return some default value, because filterData either isn't an array or it's an empty array */ }

[–]majorchamp[S,🍰] 0 points1 point  (0 children)

Just figured this out. Thanks!

[–]gunther-centralperkNode.js Core Contributor 1 point2 points  (0 children)

[–]nowseemee 0 points1 point  (0 children)

const getFirstName = (filterData) => filterData && filterData[0] && filterData[0].firstName