map is undefined if object is undefined

Viewed 421

I have this in my jsx

{get(applicant, 'user.name').map((obj,i) => <span>{obj}</span>}

if user.name not exist, my app will crash, why get doesn't solve the problem here? It's lodash's get.

If I do applicant.user.name.map my app will have chance to crash.

1 Answers
Related