I've been reviewing the documents and I can't find anything talking about whether or not Litho
supports data binding. There is one comment I've found here that says, "It supports one-directional data binding..." but there isn't anything in the docs that outlines how you might use data binding. So does Litho
support data binding, if so, how do you use it?
Does Litho Support Data Binding?
146 Views Asked by BlackHatSamurai At
1
Because Litho uses declarative approach to building UI, binding comes naturally – you just can't change a property on a View in-place, you need to recreate a new Component. So, when a new data comes from whatever source you have, you'll just recreate a Component and set it to
LithoView
orComponentTree
.Another way is to pass your
Controller
as a Prop, subscribe to data changes and on every update of data, call a State Update for the Component, let's say. For subscribing/unsubscribing you can useOnAttached
/OnDetached
methods: https://fblitho.com/docs/onattached-ondetachedLet me know, if you need more info