Fork me on GitHub

has anyone ever worked with react-spring? in clojurescript / reagent? I’m basically trying to use its Transition component. the usage in jsx is this

  items={items} keys={item => item.key}
  from={{ transform: 'translate3d(0,-40px,0)' }}
  enter={{ transform: 'translate3d(0,0px,0)' }}
  leave={{ transform: 'translate3d(0,-40px,0)' }}>
  {item => props =>
    <div style={props}>{item.text}</div>
it has 2 closure functions as children. so I’m trying to replicate the above like so
[:> spring/Transition {:items items
                            :keys  :email
                            :from  {:transform "translate3d(0, -40px, 0)"}
                            :enter {:transform "translate3d(0, 0px, 0)"}
                            :leave {:transform "translate3d(0, -40px, 0)"}}
      (fn [player]
        (fn [props]
          (reagent/as-element [:div "hello"]))]
(edited) but it throws an error saying it can’t render a function
Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.


@bravilogy maybe (fn [player] (r/reactify-component (fn [props] [:div "hello"])))


Though I'm not sure how this would be different to providing component as fn and using as-element


it turns out I was using react-spring 5.9 and when I upgraded to 6, it started working


Yeah, changelog mentions version 6 changed the API