Learn how to properly use Optional Chaining and Nullish Coalescing with TypeScript and React. The star of the show in optional chaining is the new (?.), The show’s next star is the nullish coalescing operator (??). Typically with an API call but not limited to. Depending on how deep the property was you had to write some ugly if statements to prevent the error? Well, that’s what we are going to be solving today with Optional Chaining.
The problem we are trying to solve: Have you ever had a deeply nested property in an object that any time you time to reference it you got back null because it wasn’t defined quick enough before your code ran? Typically with an API call but not limited to. Depending on how deep the property was you had to write some ugly if statements to prevent the error? Well, that’s what we are going to be solving today with Optional Chaining.
As briefly discussed in the intro, The star of the show in optional chaining is the new (?.) operator that enables you to capture the property value located deep within a chain of connected objects without checking that each property in the chain is valid.
Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.
Wanted to make a video with redux and redux-thunk using typescript. I found this a bit confusing when I first learned it and hopefully this videos makes the ...
I show how to use React with Typescript: - How to define a component How to specify props using types and interfaces - How to define state - How to handle events