Fork me on GitHub
#reagent
<
2018-05-15
>
Macroz07:05:44

@juhoteperi I was debugging komponentit/autocomplete yesterday and noticed the set-state used there. What's your take on this?

juhoteperi07:05:29

@macroz It is probably unnecessarily complex, I originally had some performance problems and didn't know how to solve them properly.

juhoteperi07:05:03

Probably the problems weren't even solved by using set-state directly, but just because I rewrote the whole component.

Macroz07:05:59

Sure. I was thinking that is there any need for set-state really, or is closure with a ratom always better, cleaner and lisper?

juhoteperi07:05:34

Should work exactly the same. set-state is anyway a RAtom that is stored in component state, so it is pretty much the same as ratom in closure.

Macroz07:05:41

set-state is really not mentioned in most tutorials so it's kind of deprecated then? 🙂

Macroz07:05:19

I can see why someone would use set-state outside of the lexical scope but then there's the state-atom as well.

juhoteperi07:05:39

set-state uses the state-atom

Macroz07:05:19

Yes, just don't see why there is both and not really "advertised" 🙂

Macroz07:05:41

Originally I assumed that set-state is something akin to setState() in React

Macroz07:05:16

Perhaps there is a more minimal wrapper of React waiting to be born?