I try to use Ramda lenses to create a sort of interface to objects, so my code doesn't really need to know the details of the structure. You can also protect against missing data and generate default return values.
So I would consider optional chaining to be a bit of a hack that a more functional approach to JavaScript can already solve more cleanly.
I try to use Ramda lenses to create a sort of interface to objects, so my code doesn't really need to know the details of the structure. You can also protect against missing data and generate default return values.
So I would consider optional chaining to be a bit of a hack that a more functional approach to JavaScript can already solve more cleanly.
ramdajs.com/docs/#lens
ramdajs.com/docs/#pathOr
etc.