# compose

Leland Richardson [G]

05/22/2019, 7:24 PM
Hey friends! I just published a blog “Compose from First Principles” talking about some of the implementation details around compose. Would love to hear your thoughts!
🔝 2
👍 30
👏 16


05/22/2019, 7:34 PM
Been waiting for this 🙂


05/22/2019, 7:49 PM
is Stack is like ListView?


05/22/2019, 8:20 PM
In Flutter (and in Compose aswell?) Stack is a way to have multiple layers of UI, but he probably meant something like a ListView/Column. Perhaps it would be better to rename it to something else in the post?

Leland Richardson [G]

05/22/2019, 8:39 PM
it’s more like
it is just a simplistic example
i originally just had
class Box : Node()
but i wanted something that had one property instead of 0


05/23/2019, 5:47 AM
I loved the post, great job @Leland Richardson [G]! Can’t wait for the next ones. And I learned about Gap Lists 👌 So Compose is like Google whiteboard tree interview questions in action 😉
😕 1

Gil Goldzweig

05/23/2019, 6:02 AM
Great post, it clears up some of the missing information about how it works in the background.
👍 1

Leland Richardson [G]

06/05/2019, 2:59 PM
hey - great question. i’ll maybe make some updates to the blog post….
the answer is kind of nuanced
what he was talking about was bringing more state into the tree as components and using them to declaratively describe more of your program
some people feel differently about this, but this is an area where i very much agree with him
the way he was doing that in react at the time of this talk was by introducing components that provide information to their children by way of having children be a function and providing the data through the parameters of the function
this was kind of the only way to do that at the time
and since then react has added features for something they call “hooks”, which can replace a lot of the use cases ryan was talking about here, without introducing the nesting and strange component classes to do it
👍 1
for the use cases he was covering, that is now considered the right way to do things in the react world
in the jetpack compose world, we have a very similar concept to hooks that we call “Effects”. (for instance, this is what
+state { .. }
+onCommit { ... }
etc are)
there are some other talks in my blog that i linked that talk about effects in more detail
the really interesting thing about effects is that i think fundamentally there are no differences between effects and @composable functions.
there’s still some discussion to be had on this, but my hope is that the concept of effects go away and they just turn into composable functions instead of a separate concept
because of the architectural differences between react and compose, this is something that react can’t ever do but i believe we can


06/06/2019, 10:50 AM
amazing 💯 thank you for the insight