Hello,
in documentation I was looking for reference about hila + react + global state management library, but found only this regarding lit: How to manage state in Hilla applications | Vaadin.
Is there official statement from vaadin regarding this topic? I have quite complex scenario where global state management library would be very convenient and usage of useContext is not permitteed. Thanks
The documentation that you found is a bit outdated and written in the context of Lit.
Now when we recommend React for rendering and signals for state management within components, the recommendation for global state management would be to use signals also there.
Unless you have some specific requirements, the general recommendation would be to just export suitable signals from a dedicated module and then use them as import { someSignal } from './globalState';
thanks for the reply, just finished your lecture “Beyond Rest” in 2025 SpringI/O
Note that what I talked about at Spring I/O was about sharing state between users. The same concepts also apply for sharing state between multiple parts of the UI within the same browser tab but you can make it significantly simpler when the values are not directly synchronized over the network. Just a regular signal(initalValue) rather than any of the specialized signal types such as ListSignal or ValueSignal that I showed. Also note that useSignal is only for signals that are owned by a component instance whereas signal is for global signals or cases where you manage the life cycle more explicitly.
Yes, got that. However I will use both the sharing between parts of UI and between users. The use case is that we need to implement shopping cart when user is shopping himself (multiple components involved, don’t want to use props, lot of validation) and also shopping cart when user is shopping and bumps 2 - 3 friends to add to cart the same items (at the same time) and get volume discount (synchronized over the network).
for people reading this thread and wanting to understand the previous comment about signals, here is summary: https://www.youtube.com/watch?v=fUxSZavRCjs