You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rum supports having multiple :child-context defined in mutliple mixins by collecting them and instructing react to merge them when needed which is great.
To be able set or access a key value pair in the react context, you must first respectively set the :childContextTypes or :contextTypes as :class-properties in rum mixins. The :class-properties of the mixins of a component are also collected, but they are then merged in a shallow way, that does not allow to aggregate the different :childContextTypes (or :contextTypes) maps.
For example, let's say that I have put into my react context the "a" and "b" objects. Now I want to use mixins to tell react I want to see those in the context of the child component my-component:
In this example, only "b" is reachable , because it was in the last mixin.
To provide a bit of context of how I encountered the issue, I am using the derivatives library mixins and I'm also writing some mixins to pass a scrum reconciler into the react context. Sadly, each time I want to use the 2 sets of mixins together on the same component, I have to make wrapper components and it is quite tedious...
Changing the way :class-properties are merged would be a breaking change (and maybe not a good idea...). We could add top level mixin keys :context-types and child-context-types that could aggregate those key/value pairs correctly?
The text was updated successfully, but these errors were encountered:
Hi,
Rum supports having multiple
:child-context
defined in mutliple mixins by collecting them and instructing react to merge them when needed which is great.To be able set or access a key value pair in the react context, you must first respectively set the
:childContextTypes
or:contextTypes
as:class-properties
in rum mixins. The:class-properties
of the mixins of a component are also collected, but they are then merged in a shallow way, that does not allow to aggregate the different:childContextTypes
(or:contextTypes
) maps.For example, let's say that I have put into my react context the "a" and "b" objects. Now I want to use mixins to tell react I want to see those in the context of the child component
my-component
:In this example, only
"b"
is reachable , because it was in the last mixin.To provide a bit of context of how I encountered the issue, I am using the derivatives library mixins and I'm also writing some mixins to pass a scrum reconciler into the react context. Sadly, each time I want to use the 2 sets of mixins together on the same component, I have to make wrapper components and it is quite tedious...
Changing the way
:class-properties
are merged would be a breaking change (and maybe not a good idea...). We could add top level mixin keys:context-types
andchild-context-types
that could aggregate those key/value pairs correctly?The text was updated successfully, but these errors were encountered: