Optional Chaining in JavaScript

Viral Patel
1 min readJun 1, 2019

Optional chaining enables capabilities for Javascript developers to perform a nil check on the objects before trying to access any object properties.

As an example:

this.props?.user?.email

Optional Chaining behaves similarly to Ruby’s pretzel(&) operator.

Check out the official babel documentation. Babel — Optional Chaining

--

--