react 2021-03-29

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

+ some example usage

yeah, you could probably parse child in the body of AnimatedDiv if you wanted