Chapter 14 Local storage and useRef

Chapter 14 discussion

Listing 14.6 includes the following snippet in it:

setIsEmployeeOfTheMonth(response?.data?.isEmployeeOfTheMonth, ...)

Not being an ECMAscript programmer and having never seen this ?. chaining I think that some explanation should be added there. For more info: Optional chaining (?.) - JavaScript | MDN

Btw, searching the book for “optional chaining” I see it being mentioned in chapter 16 and 18 which are after this first snippet…

I think the optional chaining is unnecessary is that code snippet. I’ll make an internal note to remove it from future editions of the book. Or if we leave it to give the name optional chaining to assist searching about it since it is a newer addition to JavaScript.