Fork me on GitHub
#reagent
<
2018-10-22
>
bmills00:10:45

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)

bmills00:10:01

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.

justinlee17:10:11

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)

justinlee17:10:35

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

justinlee17:10:46

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?

Bravi18:10:33

hello everyone. is there a good lib for animations?

Bravi18:10:53

what do you guys use these days? :thinking_face:

polymeris18:10:45

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.

artur20:10:09

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

artur20:10:50

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

Bravi20:10:57

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

justinlee20:10:39

@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: https://github.com/reagent-project/reagent/blob/master/doc/InteropWithReact.md

artur11:10:27

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.

artur13:10:18

Figured it out 🙂

justinlee20:10:36

@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” https://github.com/drcmda/react-spring/tree/master/examples