-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does Litho (Kotlin API) compare to Compose? #913
Comments
Sorry this has taken a while, I wrote a long answer but it didn't cover everything I wanted so ended up putting it on the backlog, and well... 18 days later. First-off, I'd recommend folks evaluate the two for themselves to see which meets their needs for product quality, perf, devx, integration with existing code (if applicable), etc: that's going to give a clearer picture most relevant to their specific context than anything I'll write below. Second, both frameworks are moving targets due to both being under active development, so who knows how long much of the below will stay accurate after posting :) As far as similarities go, both are declarative UI frameworks in which you write Comp(onents|omposables) which are effectively special static functions which should have no direct side effects while executing. They both 'resolve' down to some primitives - Views/Drawables in Litho and drawing commands in Compose for Android (I believe!). Both introduce a new way of thinking about writing UI, which solves many problems (e.g. bugs in managing UI state) and introduce fun new ones ('why is this update recreating so much of the tree?'). Both frameworks take React as a degree of inspiration, and have many of the same concepts (though litho uses the React names still): e.g. useEffect in Litho and SideEffect in Compose exist to accomplish approximately the same thing - in the same way I think someone wrote a cheatsheet for React/Compose, you could write one for many concepts between Litho/Compose. I'm not trying to say the APIs are interchangeable though - Compose has made some very cool innovations on things like gesture handling, composable functions with and without return, @composable modifiers, etc. At time of writing, some of the main differences I see are:
In some ways this is just scratching the surface, but I think it covers the broad strokes. I'll end with saying that Compose is a really amazing set of libraries built by some very clever people, so major props to the team at Google! |
I do not see this documented anywhere. I've searched the Litho docs, Github Issues, StackOverflow, and Googled for blogs.
I think an in-depth comparison would be useful for many people considering using Litho. I hope you consider adding one!
The text was updated successfully, but these errors were encountered: