How To Understand Composables & Recomposition: A Beginners Guide To Jetpack Compose
The purpose of this article is to explain a few fundamental concepts and terms regarding the Jetpack Compose UI Library on Android. I intend to use the least amount of jargon necessary, and to connect new concepts with those which may be familiar to you when appropriate.
While this is a beginners guide to Compose, it will not be a beginners guide to Android, so readers will be expected to have built at least an application or two (though not in compose necessarily).
Before we begin, I was initially planning to write a follow up article directed towards more senior developers until I came across Leland Richardson’s two part article series. Leland is not only a Software Engineer working on the Jetpack Compose team, but I see that he is a great writer as well.
While I feel my article will stand on its own as an introduction to the basics of Jetpack Compose, I strongly suggest you read his articles once you have gained some practical experience with Compose; or right away if you prefer to learn that way.
Key Terms/Concepts Explained in this article:
- A brief review of the old View System and Hierarchy
- Composables and how they stand in relation to Views
- Recomposition and how to avoid doing it very poorly!
What Is A Composable
In this section, we will discuss the most fundamental part of the Jetpack Compose library. If you are a seasoned Android developer, you may wish to skip to the sub-section titled “Are Composables Views?”
If you are not already familiar with the View system, you should read the next section as it is necessary to motivate and understand what a Composable is.
In the context of the Android SDK (the libraries we use to make user interfaces on this platform), a View is what we use to give structure…