Composability Patterns for Hologram - Looking for Your Ideas

Thanks for putting this together. Feels a bit GenServer-y which is ok but I’m wondering if it could be even simpler.

What if Hologram.Store exposed these for the API:

Store.new(initial)
Store.get(store)
Store.set(store, value)
Store.update(store, fn value -> ... end)
Store.watch(store, fn value -> ... end)
Store.derive(store_or_list_of_stores, fn value(s) -> ... end)

These could of course be wrapped in a module but wouldn’t have to be.

I’m not sure Store.watch is absolutely needed but could be handy. It would be equivalent to a svelte .subscribe to watch for changes.

2 Likes