Fork me on GitHub
#reagent
<
2016-03-27
>
adamkowalski03:03:06

hey are there any reagent components that can be used to render code on the browser? specifically clojurescript?

Jon04:03:05

I'm working on a library called respo(and respo-client for the DOM part) which is very like reagent and deku, but much simplified for the purpose of experimenting. Currently I finished making a demo with Respo called https://github.com/Memkits/wanderlist . Talk to me here if you are interested https://gitter.im/mvc-works/respo

mmeix15:03:04

Is there any known problem or drawback with generating React :keys with gensym? For example [:li {:key (gensym "item_")} ...]

mmeix15:03:42

(seems to work for me, just don't want to oversee issues...)

gadfly36115:03:00

The keys help with performace. My understanding is if you have a list of keyed items, then the list will only re-render the keyed items that have changed (instead of all of them). I think gensym wouldn't allow react to accurately check keys between renders, which may result in a rerender of the entire list each time.

mmeix15:03:49

ok, have to think more

cky15:03:37

@mmeix: Surely there must be some kind of primary key for the models underlying your list items?

cky15:03:50

Even if it’s a gensym, you should associate it with the model so it’s consistent each render.

mmeix15:03:01

List was only an example

mmeix15:03:16

I'm dealing with SVG elements

gadfly36115:03:56

I think gensym would create an id of item_X on the first render and item_Y on the second render, so react will always update the list item bc it will think its new

cky15:03:22

@gadfly361: Right, hence my point about setting the gensym onto a primary-key field on the model.

cky15:03:27

so that it’d be the same each render

mmeix15:03:31

like [:circle {:cx 12 :cy 22 :r 17}

cky15:03:01

Do your circles have an underlying model?

cky15:03:15

Surely those 12, 22, and 17 must come from somewhere.

mmeix15:03:32

ah, I see

mmeix15:03:41

the generating function should set the key/id (which could indeed work with gensym, I guess)

cky15:03:55

But you should store the gensym value onto the model.

mmeix16:03:01

of course

cky16:03:29

:thumbsup:

mmeix16:03:54

thnx for clarifying

cky16:03:58

Always my pleasure!