lilactown / helix

A simple, easy to use library for React development in ClojureScript.
Eclipse Public License 2.0
631 stars 52 forks source link

Spread JS obj #46

Closed lilactown closed 4 years ago

lilactown commented 4 years ago

This PR implements the ability to use spread props with JS objects. This way:

(let [dynamic-obj #js {:baz "jkl"}]
  ($ component {:foo "bar" & dynamic-obj}))

Works just the same as spreading a map today.

This is especially nice for using libraries that pass you props using either a hook or a render-as-child/prop pattern:

($ SomeLib
  (fn [props]
    (d/div {& props} "hi")))