I wrote a simple custom hook for handling offline mode support in Hilla applications. There are functions to check offline mode, offline mode state variable to be used with components, callback to run when state changes and couple functions to store and get data from local storage.
You can inspect the linked demo application for use cases.