I’ve been playing with https://stitches.dev/ a little bit but I can’t quite figure out how to use their styled
helper in a way that works with plain CLJS args.
(defn styled [dom-node m]
(let [react-comp (.styled stitches (name dom-node) (clj->js m))]
(fn styled-comp-wrapper [attrs child]
(rum/adapt-class react-comp attrs child))))
Curious if this might be easier with something like #helix but I guess it would be similar?what happens when you use that code you posted?
what's the reason for wrapping the adapt-class
in another fn?
@lilactown the reason for the other fn is that I need to pass attrs and children to adapt-class
Interestingly this all works when passing nil
as attrs but when I pass anything as an attribute I get Objects are not valid as a React child
this looks relevant: https://github.com/tonsky/rum/blob/0.12.3/src/rum/core.clj#L456-L458
it looks like if you don't pass a map literal to adapt-class
as the second argument, it assumes it's a child component
I would open up an issue on Rum to get the best advice, but I think you could try something like:
(js/React.createElement react-comp (daiquiri.interpreter/attributes attrs) child)