Jetpack Compose #11
lxsmnsyc
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Although not a DSL, Jetpack Compose introduces an interesting approach into UI composition.
Example component/widget:
Jetpack Compose uses the following DSL structure:
which is similar to JS:
Jetpack Compose utilizes the concept of named parameters for passing attributes, however when constructing children, it's quite different. Instanciation of components are very much like in SolidJS, the difference only is that components in Jetpack Compose are "side-effects" such that they can be arbitrarily called in the component's function body at the same time as the children's function body. With this in mind, things like
if..else
andfor..of
is normally used to render the componentsYou can explore more example comparisons with React here: https://tigeroakes.com/posts/react-to-compose-dictionary/
Beta Was this translation helpful? Give feedback.
All reactions