https://kotlinlang.org logo
a

andrew

10/28/2019, 11:08 PM
How can I shim ambient to act like state?
k

kioba

10/28/2019, 11:21 PM
you could use
Recompose { recompose -> }
a

andrew

10/28/2019, 11:24 PM
Do I wrap that around ambient?
or the whole thing
How does it work?
I was looking at Recompose earlier, but the API isn’t clear and Google doesn’t say much about it
I guess my question is, how can I recompose automatically, as opposed to just calling recompose
r

Ryan Mentley

10/28/2019, 11:50 PM
I would not recommend any approach involving manual recomposition, as one of the principles of Compose is that it recomposes automatically based on changes, without any imperative invocations like that
👌 1
l

Leland Richardson [G]

10/29/2019, 4:23 PM
@andrew it’s not clear to me what you are wanting and how it’s relating to ambients. Can you write pseudo-code demonstrating what you want to be able to do?
a

andrew

10/29/2019, 4:33 PM
I'm using ambients like contexts in react, I expected it to update, the class. I think I was think of it wrong, but now I'm using recompose. I can hook you up with some pseudo code in a bit, I'm afk atm
It works now because I'm using recompose on the components provider, and set up a subscriber to history to know when to recompose
l

Leland Richardson [G]

10/29/2019, 7:37 PM
if you’d like, send me the code you ended up with. i suspect there might be an easier way to accomplish what you’re wanting
2 Views