Fork me on GitHub

So I’m trying to work with apollo client in cljs, and they seems to be using function-as-a-child-component pattern. I can’t seem to figure out how to recreate this in reagent. Passing a function as a child simply results in an error about functions not being valid children. Anyone get this kind of thing to work before? (below is the apollo example)


oh, found my solution in the docs! Have to use as-element in the callback

Mario C.17:10:26

Hello! Quick question, can I use Reagent in a pre-existing application?

Braden Shepherdson17:10:52

pre-existing React application?

Mario C.17:10:21

No, a pre-existing cljs application

Braden Shepherdson17:10:34

I'm not expert, but I don't see why not. Reagent doesn't "take over" the whole page, it just renders components using React. the one thing I'm aware of that requires care is that you need to use reagent/atom

Braden Shepherdson17:10:50

so it can track changes and rerender components that need it.


reagent probably needs to be in control of an entire dom element. i.e, at some point you have to call (r/render [my-component] some-js-dom-element)


usually people just mound (.-body js/document)


but you could mount any portion of an existing dom structure

Mario C.17:10:15

I see I see, thanks! Would my method of building the JS stay the same IE lein cljsbuild?


hello everyone. is there a good lib for animations?


what do you guys use these days? :thinking_face:


I try to stick to CSS as much as possible (which is a lot)

Braden Shepherdson18:10:19

yeah, it's always going to be faster than using JS, even if you're careful.

Braden Shepherdson18:10:55

perhaps "more consistently smooth" is a better phrasing than "faster"; JS animations are great until a JSON blob arrives and you drop a couple frames, or whatever.

Braden Shepherdson18:10:42

either way, grease up, because every path to animation entails great suffering.


How do I setup reagent if I want to use yarn to install 3rd party react components?


So what I'm trying to to is use adapt-react-class


@braden.shepherdson, @polymeris thanks, but how would I go about an unmount animation, using css?


@artur you need to get the npm module imported, either by using shadow-cljs or by using the webpack method, then you need to read this:


I applied shadow-cljs to myu project and it seems to work just fine, except for hot reload. It does watch my changes and recompiles but in my browser the changes are not visible and refresh also doesn't bring changes.


Figured it out 🙂


@bravilogy react-spring seems pretty cool but I haven’t used any of them. there are a lot of choices out there, which tells me the problem isn’t really “solved”