1. 1
    1. 3

      I’ve recently become interested in modern declarative (whatever that means) UI frameworks and learned a bit of React, SwiftUI and Jetpack Compose. I notice that they all follow the classical Elm architecture with an important twist: aside from states that are passed from root to leaf, you can also declare “private state” that the framework manages for you:

      • useState in React
      • @State in SwiftUI
      • remember in Jetpack Compose

      However, components in these frameworks are basically just functions, so unlike widgets they don’t have inherent identities. In order to correct associate functions which pieces of the state, the frameworks must be doing something behind the scene to reestablish an identity for each components.

      This article is a really good explanation of how SwiftUI works in that regard. Jetpack Compose seems to work in pretty much the same way (this article explains it, but it’s a bit too low-level for me). React works in a similar but different way (the official doc explains it well, but it’s very problem solving-oriented and doesn’t say “view identity” explicit.)

    🇬🇧 The UK geoblock is lifted, hopefully permanently.