Fork me on GitHub
#reagent
<
2016-11-17
>
credulous14:11:08

Hi, I’m trying to render forms, but having trouble with element attributes that have single word attributes

credulous14:11:36

is there a way to render something like <button disabled> in reagent? I mean, I can include :disabled “” in the options map, but if I want the disabled state to be reactive I have to construct the option map in a let form and then do an if form to assoc the diabled to it, etc, which all seems very messy.

reefersleep15:11:14

@credulous: :disabled true and :disabled false work fine for me 🙂

reefersleep15:11:38

or :disabled nil, rather

reefersleep15:11:17

The result is either <input disabled> or <input>

credulous15:11:52

Thanks! I tried :disabled false but for whatever reason not :disabled nil

lwhorton16:11:39

is there a way to force unmount/mount an already rendered component? I know about force-update but that only seems to trigger a rerender when the props haven’t changed, but i really just want to force a complete destroy/create cycle of the reagent component.

mccraigmccraig17:11:57

@lwhorton my memory says give the component a new :key but it remains silent about whether that applies generally or only to components in collections

edannenberg17:11:36

A question on :component-did-update life cycle method, from what I gathered this should somewhat equal to :component-did-mount, everything should be rendered according to the current state after a update happened. I have a modal with multiple steps, in one of those steps I need to pass a freshly rendered html node to a JS component, but even though everything should be rendered a node lookup in :component-did-update returns nil. When I close the modal the lookup works. Is this one of those async rendering quirks of reagent?

juhoteperi17:11:53

@yogthos I opened PR yesterday to update Reagent to React 15.4: https://github.com/reagent-project/reagent/pull/276

yogthos18:11:48

@juhoteperi fantastic, I'll take a look

juhoteperi18:11:39

React core / dom / dom-server split will require some breaking API changes to prevent output size getting larger, but other than that it should be simple

yogthos19:11:32

@juhoteperi incidentally, shouldn’t the output get pruned by the closure compiler?

yogthos19:11:52

I recall that only stuff that’s actually referenced gets compiled into the minified version

juhoteperi19:11:56

@yogthos No, foreign-libs are included if they are required by any namespace

juhoteperi19:11:12

and foreign-libs are not dead-code-eliminated, they are included as is

yogthos19:11:18

ah I see, it’d have to be compiled in directly

juhoteperi19:11:16

There was a separate issue about this: https://github.com/reagent-project/reagent/issues/274 where I also explained this

yogthos19:11:29

makes sense, and I agree that including react.dom.server explicitly is the right way to go

johanatan23:11:44

@curlyfry why not use map-indexed and build the key with the index?

johanatan23:11:26

what's the best/easiest way to import a NPM module for frontend/client-side use (and this NPM module has 4-5 other modules as dependencies). Neither it or its dependencies are currently provided by CLJSJS [i haven't looked yet at the dependencies of those 4-5 other modules but if they each have a handful of dependencies, this could get painful fairly quickly] The root module in question is: react-swipeable-views if anyone knows about or alternatives to this functionality in particular