Fork me on GitHub
#reagent
<
2018-04-01
>
jmckitrick13:04:54

What are the best ways to work with a UX designer on Reagent apps?

jmckitrick13:04:04

Assuming they do not want to learn ClojureScript?

ajs15:04:07

I thought there were two ways to specify a React key on items in a sequence, but this comment suggests that only metadata is the proper way: https://stackoverflow.com/questions/33446913/reagent-react-clojurescript-warning-every-element-in-a-seq-should-have-a-unique#comment54706823_33458370

ajs15:04:36

Is that still valid? Why do I see examples of using :key in the first arg passed to a component?

justinlee17:04:18

@ajs that look backwards to me. for native elements, you can pass as a key in the props map. for components you have to use metadata. https://gist.github.com/jmlsf/17c588deb326e538dcea6847bc66db9b#keys

justinlee17:04:36

I guess this stuff didn’t make it into the /docs folder or I can’t find it right now

ajs17:04:14

You can use the metadata approach also for native elements?

justinlee17:04:14

Yes I believe so. I put together those docs from old release notes, so there’s a chance something has gone out of date. But yes, I think the metadata approach works for both

justinlee17:04:29

@jmckitrick let me know if you figure it out 🙂

ajs17:04:28

@lee.justin.m But check out this custom component (endorsed by Reagent's author) using the key map, not metadata: (for [text ["world" "universe" "multiverse"]] [my-function {:key text} text])

justinlee17:04:42

well try it. i don’t think it works. there were some changes to the way component functions worked in 0.4.0, but that happened before that bug was reported so maybe i’m just wrong

justinlee17:04:23

i’m pretty sure i tried it before and it didn’t work. i’ve never liked the metadata syntax so i remember trying to avoid it

grav19:04:30

Seems React 17 will deprecate componentWillReceiveProps. It’s often used to update local state explicitly. The new way of doing this in React 17 will be to implement getDerivedStateFromProps and return the new state in that function. I’m just wondering how this will affect Reagent? I’m always using a ratom and a form-2 component for storing the local state instead of using React’s own state.

justinlee20:04:15

i’m pretty sure reagent manages its own updates and does not depend on react’s state system. componentWillReceiveProps only appears in one place in the code base and that is just to wrap a user’s form-3 component

gadfly36120:04:33

Cross posting this from cljsjs channel (since that seems largely a bot log): Hey all, anyone willing to bump the cljsjs semantic ui react to v0.79? (https://github.com/gadfly361/soda-ash/issues/7)

justinlee20:04:06

this is where i feel smug about using shadow-cljs 😛

gadfly36120:04:34

@lee.justin.m haha i mean, it sounds like there is definitely reason to be 😆 Trying out shadow-cljs is on my 'todo list' (along with things like trying https://github.com/nervous-systems/cljs-lambda)

justinlee20:04:21

its so nice to just yarn add whatever-npm-i-damn-well-please and then just include it

Alex H20:04:07

yea, I'll second that. shadow-cljs is the only reason I'm using clojurescript, pretty much - otherwise I'd have given up a long time ago