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
Hello React team. Due to the way React injects its dependencies (notably the Component one), one cannot use two different renderers in a node.js scripts. Let's say, for instance, that I need to use both react-blessed and react-dom/server because I display a nice CLI interface and then render some html after a HTTP request, this will crash because the second renderer will override the first's one dependencies.
react-blessed appears to be calling ReactInjection, which is part of React DOM. I think the root of your problem is this erroneous dependency, whereby you are relying on global state within the core of the renderer. Ultimately react-blessed is not rendering to the DOM and should therefore not be calling into the DOM code (it should be it's own renderer, using things from renderers/shared but not from renderers/dom). I think that's what @sebmarkbage would say (cc him), also cc @spicyj for comments.
It is true that you can't (currently) have two renderers sharing the core React modules because we have this global state. (ReactInjection has nothing to do with it.) We would like to resolve this longer-term either by encouraging flat builds where each renderer has its own copy of React bundled in, or perhaps by changing the React core to make the modules instantiable and not store global state.
You may be able to work around this problem by loading two completely independent copies of React. Hope that will work for you – though if it doesn't we probably won't be up for making significant changes to support this because alternate backends are not an active priority for us right now because of time constraints. Hopefully we can support this better one day though.
Hello React team. Due to the way
React
injects its dependencies (notably the Component one), one cannot use two different renderers in a node.js scripts. Let's say, for instance, that I need to use bothreact-blessed
andreact-dom/server
because I display a nice CLI interface and then render some html after a HTTP request, this will crash because the second renderer will override the first's one dependencies.Is there a solution I would have overlooked here?
Related to Yomguithereal/react-blessed#43.
The text was updated successfully, but these errors were encountered: