Fork me on GitHub
#reagent
<
2016-07-28
>
nonrecursive01:07:18

I figured out how to get things working with ReactTransitionGroup

nonrecursive01:07:16

the re-frame tutorial (https://github.com/Day8/re-frame/wiki/Creating%20Reagent%20Components#form-3-a-class-with-life-cycle-methods) has you create the function my-component that creates a class every time you call it

nonrecursive01:07:56

then you have [my-component 1 2 3] to create an instance of your custom class

nonrecursive01:07:09

if you do something like

(def my-component (reagent/create-class {}))

[my-component 1 2 3]
it works with ReactTransitionGroup

nonrecursive01:07:17

if you do it the way the tutorial specifies, I think reagent “wraps” the custom components you create. Then ReactTransitionGroup tries to call componentWillEnter and other animation methods, but it’s trying to call them on the wrapper component, not the custom component

mikethompson03:07:50

@nonrecursive: I've not had to do any of this myself. But I;'m aware of various fucntions in core, like this one: https://github.com/reagent-project/reagent/blob/master/src/reagent/core.cljs#L56-L62

lsnape13:07:04

Hi, I’m developing a cljs SPA with reagent + re-frame and have run into some problems when binding data to components that allow text entry. I’ve found that if I bind the value of a textarea or whatever to some string in my app-state (using re-frame’s subscribe) then a flurry of on-change events can cause the cursor to jump around, or sometimes events are lossed. Is this a general problem with binding components that allow free text entry and updating them incrementally, or more likely to be a bug in my code?

lsnape13:07:49

An obvious workaround is to not update the app-state atom on every on-change event, but I like keeping the app-state and the view in sync. It feels more hygienic 🙂

pesterhazy13:07:08

@lsnape: react deals with this normally

lsnape13:07:48

@pesterhazy: will take a look, thanks!

pesterhazy13:07:48

@lsnape: this topic is also covered in this lambdaisland episode: https://lambdaisland.com/episodes/reagent-2-cursors

danielcompton23:07:55

@lsnape re-frame has a sister library re-com which is designed to avoid this too