-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Code: map (DOM.div {} <<< singleton) [DOM.p {} (), DOM.p {} ()]
produces:
Error: Invariant Violation: mountComponent(.0.0.1.1, ...): Can only mount an unmounted component. Make sure to avoid storing components between renders or reusing a single component instance in multiple places.
Code: map (DOM.div {} <<< singleton <<< DOM.text) ["a", "b"]
oddly produces 2 b
s, instead of 1 a
before 1 b
.
I'm not very familiar with reactjs, but my understanding is that the {}
is shared by all the DOM nodes thus created, and this sharing is not allowed. I've tried cloning the {}
, and it works.
My proposal is to add a group of mkDOM
wrappers cloning the props
before constructing the nodes. They may get their own module namespace. Shallow cloning should be OK as the reactive fields inside the props
observed by the React.DOM
constructors are still shared. Also, cloning is not necessary if mkDOM
is not partially applied to props
, so the non-cloning wrappers should be kept as default.