Support Optional Chaining operator

I’d love to be able to use expressions like {{ ? 'baz'}} in my components. The optional chaining operator and its relatives make it much easier to write code that won’t throw exceptions when data is missing.

You could use Babel to compile the JS so all browsers can run it.


Second this! Node and most browsers support this already.

My use case: I’m fetching an user from a database, and I’d like to access a property if it exists, otherwise return a default value: e.g. {{ || “N/A” }}. However if user is not defined, the code segment appears to exit after throwing an exception, resulting in the whole code block returning nothing. Normally I’d do: {{user?.name || “N/A” }} to avoid errors.

1 Like

Optional Chaining appears to be working fine. The current syntax checker is complaining, but just ignore it.

Optional chaining is now fully supported! :smile: Thank you all for your input (and patience) here.