DEV Community

Discussion on: How does Optional Chaining make React App development easier?

Collapse
 
rajatexplains profile image
Rajat Jain • Edited

In this way, there will be no error thrown certainly. But there will be
Welcome, printed.

A better way could be to be add a default name with ??
Welcome, {user?.dispayName??'Taishi'}