DEV Community

Discussion on: Container/View Pattern in React inc.hooks

Collapse
 
jfullerco profile image
jfullerco

This is likely going to be a rather noob question however I hadn’t seen it done before so I figured I’d ask. The ? after the element name, does that just cause it to disregard the index value? (Likely butchering my Js terminology here but hopefully the question makes sense)

Collapse
 
rmurati profile image
Redžep Murati

Hello. The ? operator will check only for the existence of value(it's called optional chaining).
Ex: userData?.email will return value of email variable if it exists otherwise undefined.
Here is a good documentation on this subject:
developer.mozilla.org/en-US/docs/W...
Hope u find this useful.