Fork me on GitHub
#helix
<
2021-10-22
>
Stefan09:10:16

Hi all, I’m doing a spike to determine what tech we want to use for our new SPA client. We are considering helix, so that’s what we’re using for our spike now. We like it a lot so far. A very important question that remains, on which I am hoping to get know your opinions, is what to use for global state management? We could use re-agent, but it appears that in that case most components have to be reagent components, which defeats the purpose of using Helix. We could use redux.js, maybe with a wrapper. What is your take on this?

alexdavis09:10:08

I have been using react-query for all state management needs, with a couple of custom hooks that use the context for things like ui theme - no state management lib like redux/reframe needed. Works very well so far

alexdavis09:10:47

But if you really want a reframe/clojury experience this looks pretty good https://github.com/orestis/reseda

Stefan10:10:09

That certainly looks interesting, never heard of it before, thanks for that pointer @alex395

Stefan10:10:38

@alex395 How well is reseda maintained? There are a few trivial pull requests open, so it gives the impression that it is not very well maintained?

Stefan10:10:27

@orestis That’s your library right? Do you consider it suitable for production use?

orestis10:10:21

Hi @stefan.van.den.oord. We use it in production, so in some sense it's suitable for production use 🙂

orestis10:10:37

Those trivial pull requests come from dependabot and are just noise

Stefan10:10:26

Ah right I see. If we are going to use this, I would actually offer to co-maintain for this kind of stuff if you like.

orestis10:10:12

It does help with a lot of aspects, especially the whole "assoc a pending promise wrapped in a "suspending" in a hook or a global store or wherever, then React will suspend until it resolves".

orestis10:10:42

In the coming months we'll have to be working more on the global store aspect of stuff and some things like optimistic updates so I'm not sure if new primitives will appear.

orestis10:10:02

To clarify: reseda is two primitives that you can combine as needed. E.g. • First: a "store" that looks like redux if you squint, but for clojure data, backed by atoms • use that in a global var, and you have a global store. Put it in a React context, you have a scoped store. Stick it in a Ref and you have component-local state • Second: support for "Suspense for Data Fetching" where you use Suspense boundaries for async data.

orestis10:10:19

The second primitive is completely orthogonal to the first, and it might see some more updates in the future.

Stefan10:10:58

Yeah it seems like a useful library. I’ll include it in my spike today or Monday.

Stefan10:10:36

For me it is mostly about the global state side of things. But what you said about suspense also sounds good.

orestis10:10:42

Let me know if you need any more guidance or if you have any feedback on the docs 🙂

Stefan10:10:05

Will do, thanks!

lilactown17:10:08

as part of your spike, it might be good to lay out exactly what kinds of state you want to be global

👍 1
lilactown17:10:22

you might find that there are purpose built solutions for those already in the JS community

lilactown17:10:54

i.e. for navigation, use react-router. for theming, use a CSS-in-JS lib

lilactown17:10:41

for data fetching, you can use react-query. although, this is the one you probably want "native" CLJS support. I'm working on something for this slowly 🙂

clojure-spin 2
lilactown17:10:11

reseda seems like a great catch all rn, although i havent used it yet

lilactown17:10:40

@orestis still trying to transfer ownership of hx to you. you'll need to delete your fork to do so 😄

orestis18:10:52

Oh I need to merge a PR that points to it :) I will do so next week and bother you again

thanks2 1