If you are tired of writing long chains of 'if' statements to avoid errors when accessing nested properties in JavaScript or TypeScript, start leaning on optional chaining (?.). It short-circuits the evaluation if a reference is nullish, returning undefined instead of throwing an error. Pair it with the nullish coalescing operator (??) to provide a default value, and your data-fetching logic will look significantly cleaner.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)