New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we still use "owner-based" context? or do "context forwarding" ? #4081
Comments
Related: #3210 |
Yeah, let's track there. cc @jimfb though. |
I think this is solved by using ReactWithAddons.renderSubtreeIntoContainer. It currently handles context forwarding but not event bubbling, but it sounds like that would work for @slorber's use case. |
Thanks @jimfb it seems to be what I'm looking for. I'm not looking for event bubbling to the parent, but simply to be able to setup click listeners that I can handle on the child directly. @jimfb is this available in 0.13? It seems not to be. So to achieve this I'm going to wait for 0.14 right? This produces a lot of warnings in 0.13 and is really bothering me. Can we disable this warning in 0.13? I can use static markup for now and wait for 0.14 but this produce a lot of warnings :( Also does it really work? Because here: |
So it seems I can get rid of warnings with production mode, but in dev it's still bothering me because of the quantity. I've tried to monkey-patch the warning but this is not easy, as patching ReactCompositeComponent after requiring it is useless since the warning method as already been used in ReactCompositeComponentWrapper of instantiateReactComponent. |
@slorber console.warn = function(text) {
if (!text.startsWith('owner-based and parent-based contexts differ')) {
console.log(text);
}
}; This filters the unwanted warnings out. Note that the changed |
thanks @cody this is what I've finally hacked :) // TODO remove this after 0.14, see https://github.com/facebook/react/issues/4081
var warn = console.warn;
var warningFilterKey = function(warning) {
return warning.indexOf("Warning: owner-based and parent-based contexts differ") >= 0
};
var throttledWarn = _.throttle(function() {
warn.call(console,"Stample throttled warning about React owner/parent based contexts, see https://github.com/facebook/react/issues/4081 for reasons");
warn.apply(console, arguments);
},60000);
console.warn = function() {
if ( arguments && arguments.length > 0 && typeof arguments[0] === "string" && warningFilterKey(arguments[0]) ) {
throttledWarn.apply(throttledWarn,arguments);
}
else {
warn.apply(console, arguments);
}
}; |
thanks @jimfb but what does it mean? Will it be released in 0.14? |
Yes, 0.14 will be parent-based-context, and renderSubtreeIntoContainer will be made available publicly. You can start playing with it in React 0.14-alpha3, which is up on NPM. |
thanks :) As we have short release cycles I'll keep using 0.13 with the disabled warning but will try to switch to 0.14 as soon as we have a stable RC (after fixing the addons.classSet and body mouting errors :)) |
I mean we still can (in 0.13) with a warning but it will probably not be possible in the future.
I use a Tooltip positionning library but it does only accept raw html strings.
I want to be able to render React content inside the tooltips after the lib has positionned them (generally in ). It works fine with
renderStaticMarkup
.There is no parent/child relationship between the tooltipable content and the tooltip (it often causes troubles with z-index: we generally want the tooltips to overflow)
My code looks like:
It works fine.
The problem is: I'd like to be able to use the normal application context inside my own tooltip content.
Somehow I have to "forward" the context of
WithTooltip
to the tooltip content. Is it possible?I'd like it to be "dynamic" and not have to maintain a list of childContextTypes etc...
The log I have is:
Warning: owner-based and parent-based contexts differ (values:
frvs
undefined) for key (locales) while mounting CategoryName (see: http://fb.me/react-context-by-parent) warning.js:48
The text was updated successfully, but these errors were encountered: