The most important thing to understand is that “?” optional property and same property declared as required but possibly undefined mean absolutely different things.
Typescript “?” operator means that parameter is optional, it’s not necessary to pass it in component/function.
Undefined means that parameter must be passed in but its value may be undefined.
You shouldn’t use “?” as a replacement of undefined and vice versa even though “?” …
When you run a React application that was created by using create-react-app under HTTPS=true flag then whenever you try to reach your application under http:// it shows you an error and whenever you try to reach your app under https:// it shows that connection is not secure. To solve this issue some people use ngrok. You can run into the problem trough if you start ngrok using their default configuration:
ngrok http 3000
I faced the problem that ngrok documentation does not say much on how to set…
Promise.all() allows us to run code in parallel but we can’t use it in some cases. Cases like when it’s really important for us to execute promises in a specific order and we also have code that prepares some data in between.
Let’s take a look at example where we want to create a book in our database and book should have pages and name.
Example with “await”:
// preparing data that takes quite some time
const thousandsOfPages = await getAllPages();
const sortedPages = thousandsOfPages.sort();// we are waiting for this promise to resolve for quite some time and blocking…
Frontend developer | A strong believer in code best practices