-
Notifications
You must be signed in to change notification settings - Fork 125
Description
The rum.core/with-key and rum.core/with-ref functions call the underlying React .cloneElement function to create a new React component that includes the supplied key or ref, respectively. Both with-key and with-ref use full function signature version of .cloneElement and pass nil for the optional last argument corresponding to the new component's children. This leads to the resulting component missing the children of the original. If the smaller arity function signature is used omitting the nil, the resulting component will have all of the original component's children.
Is this intended? If so, what is the proper way to use with-key and with-ref so the resulting components also includes the original component's children?
If this was not intended, I have defined these functions as a workaround that works for me:
(defn with-key
[elt k]
(js/React.cloneElement elt #js {"key" k}))
(defn with-ref
[elt r]
(js/React.cloneElement elt #js {"ref" r}))