helix

https://github.com/Lokeh/helix
Jakub Holý 2020-07-06T08:47:58.308700Z

Question: Why doesn't the state setter from use-state behave like Clojure's update , i.e. having a multi-arity version that takes a-fn and any number of arguments and runs (a-fn current-state args...) ? That way I could replace my (.then (fn [p] (set-state #(assoc % :person p)))) with the simpler (.then (fn [p] (set-state assoc :person p)))) ?

✅ 2
Aron 2020-07-06T09:42:08.309200Z

because sometimes I just want to overwrite everything with a literal and not update the state

Aron 2020-07-06T09:42:38.309700Z

well, that was a silly answer, you can just set it with this too, sorry

Aron 2020-07-06T09:43:03.310300Z

but I like that helix is just a shallow wrapper, maybe a custom hook that you write could do this? I am interested

Jakub Holý 2020-07-06T10:39:47.311Z

Hm, the docs actually describe this functionality. I have to learn to read the docs fully 😅

Aron 2020-07-06T10:57:56.311800Z

😄

Aron 2020-07-06T10:57:59.312Z

me too

lilactown 2020-07-06T16:46:37.312300Z

@holyjak it does

lilactown 2020-07-06T16:46:48.312500Z

was it not working?

Jakub Holý 2020-07-06T16:57:27.312600Z

No, everything is OK. I stopped trading the docs too early :)

ordnungswidrig 2020-07-06T19:35:12.313Z

I failed on that one, too!