Hello, I am wondering how to maintain a global sta...
# compose
h
Hello, I am wondering how to maintain a global state in Compose, like I have a user that i fetch from my backend, and i want to be able to access the user object throughout the app lifecycle
c
I don't think compose really adds anything new here. If you want a user to be scoped and available through your application, you will have to put it in a place that has a lifecycle roughly equivalent to what you're looking for. I typically create an AppUserManager and it's a singleton and it handles whether the user is logged in or out or w/e and then I just inject it into my VMs if I need it.
1