Fork me on GitHub
#clojurescript
<
2020-01-25
>
Kamuela01:01:46

Slow to run code once it’s up. Very slow

J15:01:22

Hi! Which react wrapper can i use in 2020 for a React Native (Web) app. I love Reagent (with ReFrame) but is there modern and viable alternative (with recent React version) ?

darwin23:01:37

first write your own wrapper and then based on your newly gained experience you will be fully qualified to pick one from existing libs 🙂

😁 4
anson08:01:44

@UHZPYLPU1 @U08E3BBST has recommended https://github.com/roman01la/uix highly elsewhere, and I recently posted https://github.com/anrosent/rct as my own “first write your own wrapper”. Hope this helps!

Kamuela12:01:54

Wait, are we saying that Reagent is out of date?

anson13:01:52

I don’t think so. I think “modern” in this context suggests getting leverage from new features in React, whether that means new capabilities/better ergonomics or equivalent capabilities with a simpler library. I haven’t done enough work with react or reagent to know the tradeoffs over the lifetime of a big app, but I see the appeal given that hooks/suspense are powerful (relatively) new primitives from core react.

Kamuela13:01:35

Hooks are about better ergonomics for per-component state. A lot of the React community has been moving away from the redux "state tree" approach and acting like "duh, it rarely makes sense." Kind of pisses me off actually because I don't understand why we reached peaked functional and are now moving backwards

darwin13:01:24

Dan Abramov did pretty good job convincing me that hooks are the way to go here: https://www.youtube.com/watch?v=V-QO-KO90iQ it still does not prevent you from passing some state via props, or subscribing to global state via context but I’m a React noob

Kamuela13:01:37

I'll watch it if only to understand what I see as madness coming straight from the top

Kamuela14:01:32

Mm yeah, I can see that patterns like dealing with DOM input, etc are easier. Network calls still should happen centrally, imo

adz5a20:01:21

hello. I noticed that react seems to be OK with cljs lazy-seq returned by map (react is expecting a js array), ie this snippets works (`jsx` is just a macros that turns hiccup into react/createElement calls). Anybody would happen to know why it works ? I would have thought that react would complain upon receiving a lazy-seq instead of an array

[:ul
      (map
        (fn [_ id]
          (jsx [:li {:key id} "hello"]))
        (repeat 3 {:identifier 'yolo :value "wesh"})
        (range))]
     

adz5a20:01:42

Ok it is because of (es6-iterable LazySeq) in src/main/cljs/cljs/core.cljs:3494 which adds the es 6 iteration protocol to the LazySeq type imo

☝️ 4
😲 4
lilactown20:01:17

pretty handy eh?

adz5a20:01:10

indeed, i did not know react supported es6 iterators

thheller21:01:59

@adz5a you should avoid lazy seqs at all cost. they cause very weird behavior when using the "production" version of react. it only works fine in development.