Here’s my Rum React Spring API wrapper:
(ns icebreaker.components.animations
(:require [rum.core :as rum]
["react-spring" :as rs]))
(rum/defc AnimatedDiv < rum/static
[style child]
(js/React.createElement rs/animated.div (clj->js style) child))
(defn use-spring
[config-map]
(rs/useSpring (clj->js config-map)))
😂seems good!
I think this requires that child
is a react component, i.e. it can’t be hiccup but that is fine for my immediate needs
also put it in a gist here: https://gist.github.com/martinklepsch/0cc942365e472671eee2ad5a363c34e7
+ some example usage
yeah, you could probably parse child
in the body of AnimatedDiv
if you wanted