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
Screenshot with 502 server error
Screenshot with 502 server error

It happens because by default ngrok binds to http://localhost:3000 instead of https://localhost: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.

Woman is thinking in front of the laptop
Woman is thinking in front of the laptop

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…

Kate Shastakova

Frontend developer | A strong believer in code best practices

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store