Day 16: Async & Forms
Event Handling & Async
Sometimes in our code, we want to call a function sometime in the future. These functions are called Callback Functions and they are typically used to handle asynchronous tasks such as reading a file or making a request to a server. We can also use callback functions to handle user events such as the user clicking on something on the screen. Callback functions allow us to react to the user event and then run certain code whenever that event happens.
Forms allow users to type or enter data into our websites! We can then send that data to a server for some type of use, (we can also sell that data to advertising agencies and make billions). Forms are created with the form tag and we can collect data with a variety of input tags including, textareas, radio buttons, checkboxes, and more. Form submissions will trigger a submit event where we can handle the form data.
Knowing how to use callback functions, and creating forms is an important part of web development. Sometimes managing form state can be complex so I have been using Formik! Check them out if you want an easier time managing your forms. ✌🏼