zendevil.eth
zendevil.eth

Reputation: 1102

How to convert the following js style map to clojurescript?

I want to write this js style map in cljs:

const pathLength = useSpring(yRange, { stiffness: 400, damping: 90 })

<div style={{
                        pathLength,
                        rotate: 90,
                        translateX: 5,
                        translateY: 5,
                        scaleX: -1, // Reverse direction of line animation
                    }}></div>
                   

I have the following:


[:div {:style  {path-length
               :rotate 90 :translateX 5
               :translateY 5
               :scaleX -1}}]

But the error I get is:

Map literals must contain an even number of forms.

How to fix this?

Upvotes: 1

Views: 52

Answers (1)

Thomas Heller
Thomas Heller

Reputation: 4356

{ pathLength } in JS is short for { pathLength: pathLength }.

In CLJS you just write {:pathLength path-length}.

Upvotes: 1

Related Questions