What are callbacks?April 16, 2020 - 1 min read 🍵
What is a callback function
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete an action or routine. It is also a function that is executed after another function is finished when called in as the argument, hence, the name “call back”.
Why are they important?
There are times where we request data from an external source such as an API and we have no idea when it will respond back with data. In this case, we want to wait for the data before we proceed to the next function. Thus, a callback can be used.