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.

This function will be called when the user clicks.

HTML Forms

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.

A form submit event being handled by formik.

Closing

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. ✌🏼

This copy is accurate…

--

--

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